Compare commits
No commits in common. "master" and "v0.1.7" have entirely different histories.
4 changed files with 12 additions and 10 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,3 +1,5 @@
|
|||
**/uuids
|
||||
|
||||
.vscode/.browse.*
|
||||
nimsuggest.log
|
||||
|
||||
|
|
|
|||
|
|
@ -16,16 +16,16 @@ when defined(windows):
|
|||
proc CryptAcquireContext(
|
||||
phProv: ptr HCRYPTPROV, pszContainer: WideCString,
|
||||
pszProvider: WideCString, dwProvType: DWORD, dwFlags: DWORD
|
||||
): WINBOOL {.importc: "CryptAcquireContextW".}
|
||||
): WinBool {.importc: "CryptAcquireContextW".}
|
||||
else:
|
||||
proc CryptAcquireContext(
|
||||
phProv: ptr HCRYPTPROV, pszContainer: cstring, pszProvider: cstring,
|
||||
dwProvType: DWORD, dwFlags: DWORD
|
||||
): WINBOOL {.importc: "CryptAcquireContextA".}
|
||||
): WinBool {.importc: "CryptAcquireContextA".}
|
||||
|
||||
proc CryptGenRandom(
|
||||
hProv: HCRYPTPROV, dwLen: DWORD, pbBuffer: pointer
|
||||
): WINBOOL {.importc: "CryptGenRandom".}
|
||||
): WinBool {.importc: "CryptGenRandom".}
|
||||
|
||||
{.pop.}
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import strutils, hashes
|
||||
import isaac
|
||||
import uuids/urandom
|
||||
import urandom
|
||||
|
||||
type
|
||||
UUID* = object
|
||||
|
|
@ -10,17 +10,16 @@ type
|
|||
|
||||
template toHex(s: string, start: Natural,
|
||||
x: BiggestInt, len: Positive) =
|
||||
const HexChars = ['0', '1', '2', '3', '4', '5', '6', '7', '8',
|
||||
'9', 'a', 'b', 'c', 'd', 'e', 'f']
|
||||
const HexChars = "0123456789abcdef"
|
||||
var n = x
|
||||
for j in countdown(len - 1, 0):
|
||||
s[start + j] = HexChars[int(n and 0xF)]
|
||||
s[start + j] = HexChars[n and 0xF]
|
||||
n = n shr 4
|
||||
# handle negative overflow
|
||||
if n == 0 and x < 0: n = -1
|
||||
|
||||
proc uuidsParseHexInt(s: string, maxLen: int): int64 =
|
||||
if s.len == 0:
|
||||
if s.isNil or s.len == 0:
|
||||
raise newException(ValueError, "UUID part is empty")
|
||||
if s.len > maxLen or s.len > sizeof(result) * 2:
|
||||
raise newException(ValueError, "UUID part is longer than expected")
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
[Package]
|
||||
name: "uuids"
|
||||
version: "0.1.11"
|
||||
version: "0.1.7"
|
||||
author: "Xored Software, Inc."
|
||||
description: "UUID library"
|
||||
license: "MIT"
|
||||
srcDir: "src"
|
||||
|
||||
[Deps]
|
||||
requires: "isaac >= 0.1.3"
|
||||
requires: "isaac >= 0.1.2"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue