-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
md5 docs says "Note: The procs in this module can be used at compile time.". However, toMD5 does not work.
Example
import md5
static:
block working:
doAssert(getMD5("Franz jagt im komplett verwahrlosten Taxi quer durch Bayern") ==
"a3cca2b2aa1e3b5b3b5aad99a8529074")
doAssert(getMD5("Frank jagt im komplett verwahrlosten Taxi quer durch Bayern") ==
"7e716d0e702df0505fc72e2b89467910")
block failing:
doAssert($toMD5("") == "d41d8cd98f00b204e9800998ecf8427e")
discard toMD5("")Current Output
nim/lib/system/memory.nim(21, 5) Error: cannot 'importc' variable at compile time; c_memset
Expected Output
compiles
Possible Solution
Looking at the code, there is no reason for md5 to use cstring/pointer behavior. There is already some use of openarray so it's puzzling why it doesn't use openarray in place of cstring/pointer as well, the buffer used is an array[0..63, uint8]. Same seems to go for endians/oids/sha1.
Additional Information
- Documentation added in Improve documentation for the md5 module #16631, can't find any tests for md5 at compile time
$ nim -v
Nim Compiler Version 1.6.2
Metadata
Metadata
Assignees
Labels
No labels