diff options
Diffstat (limited to 'lib/pure/md5.nim')
-rw-r--r-- | lib/pure/md5.nim | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/lib/pure/md5.nim b/lib/pure/md5.nim index cd4d1e6b8..9c3f6d51b 100644 --- a/lib/pure/md5.nim +++ b/lib/pure/md5.nim @@ -14,10 +14,12 @@ ## See also ## ======== ## * `base64 module<base64.html>`_ for a Base64 encoder and decoder -## * `std/sha1 module <sha1.html>`_ for the SHA-1 checksum algorithm +## * `sha1 module <sha1.html>`_ for the SHA-1 checksum algorithm ## * `hashes module<hashes.html>`_ for efficient computations of hash values ## for diverse Nim types +{.deprecated: "use command `nimble install checksums` and import `checksums/md5` instead".} + when defined(nimHasStyleChecks): {.push styleChecks: off.} @@ -98,32 +100,19 @@ proc decode(dest: var openArray[uint8], src: openArray[uint32]) = dest[i+3] = uint8(src[j] shr 24 and 0xff'u32) inc(i, 4) -template slice(s: string, a, b): openArray[uint8] = - when nimvm: - # toOpenArray is not implemented in VM - var s2 = newSeq[uint8](s.len) - for i in 0 ..< s2.len: - s2[i] = uint8(s[i]) - s2 - else: - s.toOpenArrayByte(a, b) - template slice(s: cstring, a, b): openArray[uint8] = when nimvm: # toOpenArray is not implemented in VM - slice($s, a, b) + toOpenArrayByte($s, a, b) else: when defined(js): # toOpenArrayByte for cstring is not implemented in JS - slice($s, a, b) + toOpenArrayByte($s, a, b) else: s.toOpenArrayByte(a, b) template slice(s: openArray[uint8], a, b): openArray[uint8] = - when nimvm: - s[a .. b] - else: - s.toOpenArray(a, b) + s.toOpenArray(a, b) const useMem = declared(copyMem) @@ -343,4 +332,4 @@ proc md5Final*(c: var MD5Context, digest: var MD5Digest) = when defined(nimHasStyleChecks): - {.pop.} #{.push styleChecks: off.} + {.pop.} #{.push styleChecks: off.} \ No newline at end of file |