digitalmars.D.learn - Compile time digest error
- tcak (24/24) Nov 09 2015 [code]
[code] private static import std.digest.md; public enum HashValue = std.digest.digest.digest!( std.digest.md.MD5)( "" ); void main(){} [/code] [output] dmd main.d /usr/include/dmd/phobos/std/digest/md.d(202): Error: reinterpreting cast from uint[16] to ubyte* is not supported in CTFE /usr/include/dmd/phobos/std/digest/md.d(320): called from here: this.transform(&this._buffer) /usr/include/dmd/phobos/std/digest/md.d(381): called from here: this.put(cast(const(ubyte)[])bits) /usr/include/dmd/phobos/std/digest/digest.d(458): called from here: hash.finish() main.d(3): called from here: digest("") [/output] I would expect MD5 to work on compile time, but as the error indicates, the uint[16] to ubyte* conversion prevents that. I tried with "std.digest.md.md5Of" as well, and same result. Is there any MD5 function that returns a fixed length array like ubyte[16] maybe?
Nov 09 2015