Skip to content

Commit f872632

Browse files
authored
Merge pull request #2 from yglukhov/sha1digest-conflict
Reuse Sha1Digest type from sha1 package
2 parents 7a01929 + 284f723 commit f872632

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

scram/private/types.nim

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
type
22
ScramError* = object of SystemError
33

4-
Sha1Digest* = array[20, uint8]
5-
64
DigestType* = enum
75
MD5
86
SHA1

scram/private/utils.nim

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import random, base64, strutils, types, hmac
1+
import random, base64, strutils, types, hmac, sha1
22
randomize()
33

4-
proc `$`*(sha: Sha1Digest): string =
5-
result = ""
6-
for v in sha:
7-
result.add(toHex(int(v), 2))
4+
proc `$`*(sha: Sha1Digest): string = sha.toHex()
85

96
proc makeNonce*(): string {.inline.} = result = base64.encode($random(1.0))[0..^3]
107

0 commit comments

Comments
 (0)