diff options
| author | simponic <simponic@hatecomputers.club> | 2024-03-28 12:57:35 -0400 |
|---|---|---|
| committer | simponic <simponic@hatecomputers.club> | 2024-03-28 12:57:35 -0400 |
| commit | b2fc689bdcff28bf75c0128db19ba4730d726b4f (patch) | |
| tree | 37c16d95183242516ba667aa5f441539d152c279 /utils/RandomId.go | |
| parent | 75ba836d6072235fc7a71659f8630ab3c1b210ad (diff) | |
| download | hatecomputers.club-b2fc689bdcff28bf75c0128db19ba4730d726b4f.tar.gz hatecomputers.club-b2fc689bdcff28bf75c0128db19ba4730d726b4f.zip | |
dns api (#1)
Co-authored-by: Elizabeth Hunt <elizabeth.hunt@simponic.xyz>
Reviewed-on: https://git.hatecomputers.club/hatecomputers/hatecomputers.club/pulls/1
Diffstat (limited to 'utils/RandomId.go')
| -rw-r--r-- | utils/RandomId.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/utils/RandomId.go b/utils/RandomId.go index 09f089d..1b03ec8 100644 --- a/utils/RandomId.go +++ b/utils/RandomId.go @@ -6,14 +6,11 @@ import ( ) func RandomId() string { - uuid := make([]byte, 16) - _, err := rand.Read(uuid) + id := make([]byte, 16) + _, err := rand.Read(id) if err != nil { panic(err) } - uuid[8] = uuid[8]&^0xc0 | 0x80 - uuid[6] = uuid[6]&^0xf0 | 0x40 - - return fmt.Sprintf("%x-%x-%x-%x-%x", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]) + return fmt.Sprintf("%x", id) } |
