diff options
author | Ivan Bobev <bobeff@gmail.com> | 2019-07-04 23:29:03 +0300 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-07-04 22:29:03 +0200 |
commit | d914dca513dca77510077862ace5420792129bca (patch) | |
tree | 8855db7844ca3d055a476b32a62c71a748c44c19 | |
parent | 0a501932c234d6150e3952f5e62b265ce34a0312 (diff) | |
download | Nim-d914dca513dca77510077862ace5420792129bca.tar.gz |
Make public some sha1 module procedures (#11655) [feature]
Make "newSha1State", "update" and "finalize" procedures from the sha1 module public in order to be possible to compute single sha1 hash of multiple separate blocks of data.
-rw-r--r-- | lib/std/sha1.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/sha1.nim b/lib/std/sha1.nim index 4cc38ec2e..cd100cd86 100644 --- a/lib/std/sha1.nim +++ b/lib/std/sha1.nim @@ -52,7 +52,7 @@ type # This implementation of the SHA1 algorithm was ported from the Chromium OS one # with minor modifications that should not affect its functionality. -proc newSha1State(): Sha1State = +proc newSha1State*(): Sha1State = result.count = 0 result.state[0] = 0x67452301'u32 result.state[1] = 0xEFCDAB89'u32 @@ -145,7 +145,7 @@ proc transform(ctx: var Sha1State) = ctx.state[3] += D ctx.state[4] += E -proc update(ctx: var Sha1State, data: openArray[char]) = +proc update*(ctx: var Sha1State, data: openArray[char]) = var i = ctx.count mod 64 var j = 0 var len = data.len @@ -176,7 +176,7 @@ proc update(ctx: var Sha1State, data: openArray[char]) = i = 0 ctx.count += data.len -proc finalize(ctx: var Sha1State): Sha1Digest = +proc finalize*(ctx: var Sha1State): Sha1Digest = var cnt = uint64(ctx.count * 8) # A 1 bit update(ctx, "\x80") |