On Saturday, 10 September 2016 at 12:18:22 UTC, Basile B. wrote:
On Saturday, 10 September 2016 at 12:12:28 UTC, Basile B. wrote:
On Saturday, 10 September 2016 at 12:04:08 UTC, Neurone wrote:
Hi,

I want to read a text file that contains sha1 hashes in hexidecimal, then convert the hashes back into ubyte[20]. Examples of some lines:
E9785DC5  D43B5F67  F1B7D1CB  33279B7C  284E2593
04150E8F  1840BCA2  972BE1C5  2DE81039  0C486F9C

How can I do this? The documentation for format strings is pretty dense, so couldn't understand most of it.

at compile time you can do:

import std.conv;
enum array = hexString!(import(theFile));

the run-time version was proposed (https://github.com/dlang/phobos/pull/4487) but not interesting enough ;)

No actually,

Finally i would have worked, after cast(ubyte[]) hexString(stuff).array;
fart...

Reply via email to