vincenthz / hs-cryptohash

efficient and practical cryptohashing in haskell. DEPRECATED in favor of cryptonite
Other
30 stars 24 forks source link

Is cryptohash as high-level as it could be? #30

Closed nh2 closed 1 year ago

nh2 commented 9 years ago

We were just looking at toHex and wondering whether it's necessary to write such a low-level concatMap.

Couldn't bytestring provide an inlinable combinator with which this could be expressed in a completely memory-safe fashion?

@vincenthz Have you had tries in the past to do this?

vincenthz commented 9 years ago

a concatMap approach will have quite a different profile, in term of memory usage and cpu usage. Also note that this is the same approach taken in base16-bytestring for performance reasons.

nh2 commented 9 years ago

@vincenthz I'm not suggesting to literally use concatMap, I'm rather asking whether you think that bytestring could provide a concatMap-like function which allows you to write toHex in a safe way (i.e. only providing a Char -> ByteString or Char -> Storable something function) with the same performance characteristics.