unipdf/internal/uuid/uuid.go
2023-11-11 11:29:03 +00:00

14 lines
1.1 KiB
Go

//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
package uuid ;import (_ac "crypto/rand";_f "encoding/hex";_g "io";);func MustUUID ()UUID {uuid ,_c :=NewUUID ();if _c !=nil {panic (_c );};return uuid ;};type UUID [16]byte ;var Nil =_ce ;func (_e UUID )String ()string {var _b [36]byte ;_gcf (_b [:],_e );
return string (_b [:])};func NewUUID ()(UUID ,error ){var uuid UUID ;_ ,_d :=_g .ReadFull (_fc ,uuid [:]);if _d !=nil {return _ce ,_d ;};uuid [6]=(uuid [6]&0x0f)|0x40;uuid [8]=(uuid [8]&0x3f)|0x80;return uuid ,nil ;};var _fc =_ac .Reader ;func _gcf (_dg []byte ,_bg UUID ){_f .Encode (_dg ,_bg [:4]);
_dg [8]='-';_f .Encode (_dg [9:13],_bg [4:6]);_dg [13]='-';_f .Encode (_dg [14:18],_bg [6:8]);_dg [18]='-';_f .Encode (_dg [19:23],_bg [8:10]);_dg [23]='-';_f .Encode (_dg [24:],_bg [10:]);};var _ce UUID ;