This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
How would you go about passing a numeric value to a secure cryptographic hashing algorithm like MD5, SHA2, etc.? From what I can tell they're only ever meant to handle a series of bytes. Would you convert say, an unsigned integer an array of bytes? What about signed integers? Floating points? Or would you just leave that as an exercise for the user to convert a number to bytes and then hash that?
Edit: Sorry I wasn't clear. I was just trying to be vaguely non-specific. I assure you I'm not lost. I'm the proprietor of the Euphoria programming language. Here's my problem: our built-in "hash" function is currently just a few checksum algorithms (Hsieh-32, Adler-32, and Fletcher-32) but it does currently support any data type by way of type punning integers and atoms (doubles) into bytes via unions, and by traversing nested sequences (arrays) using recursion. Frankly it's awful and I hate it. I want to implement actual cryptographic hashing algorithms like MD5, SHA2, etc. (yes, they're not all secure, sorry. corrected above.) but first I want to validate that I'm not crazy: hashing algorithms should just process byte arrays and let the user take whatever measures they want to convert non-byte data into bytes first (which we do have functions for) if necessary.
Subreddit
Post Details
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/Programming...