diff options
author | Adam Strzelecki <ono@java.pl> | 2015-06-09 22:15:51 +0200 |
---|---|---|
committer | Adam Strzelecki <ono@java.pl> | 2015-06-09 22:20:06 +0200 |
commit | 54c863d6ae36faa9ba14fa2a5c34ea38d4be6efe (patch) | |
tree | 1e908358a39339d3d716bab682d3e2de033c163c /compiler | |
parent | eccc2f87e9dfa7e849e027bef857a390de3e9bae (diff) | |
download | Nim-54c863d6ae36faa9ba14fa2a5c34ea38d4be6efe.tar.gz |
securehash: sha_digest_size is not following style
https://github.com/Araq/Nim/wiki/Style-Guide-for-Nim-Code
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/securehash.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/securehash.nim b/compiler/securehash.nim index 12950f137..ad15c2e8f 100644 --- a/compiler/securehash.nim +++ b/compiler/securehash.nim @@ -10,10 +10,10 @@ import strutils, unsigned -const sha_digest_size = 20 +const SHA1DigestSize = 20 type - SHA1Digest = array[0 .. sha_digest_size-1, uint8] + SHA1Digest = array[0 .. SHA1DigestSize-1, uint8] SecureHash* = distinct SHA1Digest proc sha1(src: string) : SHA1Digest @@ -26,7 +26,7 @@ proc `$`*(self: SecureHash): string = result.add(toHex(int(v), 2)) proc parseSecureHash*(hash: string): SecureHash = - for i in 0.. <sha_digest_size: + for i in 0.. <SHA1DigestSize: SHA1Digest(result)[i] = uint8(parseHexInt(hash[i*2] & hash[i*2 + 1])) proc `==`*(a, b: SecureHash): bool = @@ -191,7 +191,7 @@ template computeInternal(src: expr): stmt {.immediate.} = # Store hash in result pointer, and make sure we get in in the correct order # on both endian models. - for i in 0 .. sha_digest_size-1: + for i in 0 .. SHA1DigestSize-1: result[i] = uint8((int(state[i shr 2]) shr ((3-(i and 3)) * 8)) and 255) proc sha1(src: string) : SHA1Digest = |