Re: Converting uint[] slice to string for the purpose of hashing?

2015-07-23 Thread Enjoys Math via Digitalmars-d-learn
On Thursday, 23 July 2015 at 11:49:05 UTC, cym13 wrote: On Thursday, 23 July 2015 at 11:15:46 UTC, Enjoys Math wrote: 1. Is the best way to hash a uint[] slice 2. How do you do it? IIRC, std.digest functions take ubyte[] as input, so to hash a uint[] I would do the following: void

Re: Converting uint[] slice to string for the purpose of hashing?

2015-07-23 Thread Enjoys Math via Digitalmars-d-learn
On Thursday, 23 July 2015 at 12:10:04 UTC, Enjoys Math wrote: On Thursday, 23 July 2015 at 11:49:05 UTC, cym13 wrote: [...] Thanks. That worked. Here's my code: module hashtools; import std.conv; import std.digest.md; string uintSliceToHash(const uint[] slice) { auto md5 = new

Converting uint[] slice to string for the purpose of hashing?

2015-07-23 Thread Enjoys Math via Digitalmars-d-learn
1. Is the best way to hash a uint[] slice 2. How do you do it?

Re: Converting uint[] slice to string for the purpose of hashing?

2015-07-23 Thread cym13 via Digitalmars-d-learn
On Thursday, 23 July 2015 at 11:15:46 UTC, Enjoys Math wrote: 1. Is the best way to hash a uint[] slice 2. How do you do it? IIRC, std.digest functions take ubyte[] as input, so to hash a uint[] I would do the following: void main(string[] args) { import std.conv;

Re: Converting uint[] slice to string for the purpose of hashing?

2015-07-23 Thread Temtaime via Digitalmars-d-learn
All types are hashable and for your own structs and classes you can redefine opHash

Re: Converting uint[] slice to string for the purpose of hashing?

2015-07-23 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 23, 2015 12:56:13 Temtaime via Digitalmars-d-learn wrote: All types are hashable and for your own structs and classes you can redefine opHash It's toHash, actually, but yeah. - Jonathan M Davis