823
Different philosophies
(jlai.lu)
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Why even bother with things like strings for a salt? I would expect it to just take a byte array. Just create some random bytes and provide that.
Yeah, that's my thinking, too. But the library only takes b64.
Edit: also, if anything, this system reduces the benefit of strong typing. You can feed whatever string you want into it and the compiler will say it's OK, even if it would fail at run time. If it were a
Vec<u8>
, then the compiler can check things. Especially if you do something to let the compiler enforce the length (if possible).Or hand over a UUID object directly. Yeah, it ties it to a specific library, but it's either that or you're not taking full advantage of strong typing.
Or just have a sensible default implementation.