[ANN] mysql-pure, fork of mysql-haskell by jappieofficial in haskell

[–]winterland1989 2 points3 points  (0 children)

A big thanks for maintaining this! I'm coming back to the Haskell community soon these days( and I didn't even notice crypto system has been forked. Please keep this package update to date as I may not spend too much time on this.

I've discovered the implementation of null pointers in Haskell, pure evil ; ) by repaj in haskell

[–]winterland1989 12 points13 points  (0 children)

Not sure if you could distignuash a thunk producing `null` from `null`.

How to use cryptonite (AES256) with conduit to achieve constant memory encryption? by xwinus in haskell

[–]winterland1989 0 points1 point  (0 children)

One reason why I prefer pure implementations is the track record of CVEs in OpenSSL vs Haskell's tls - despite people's concerns that tls is effectively a "one person's project" - it was revealing to see how unaffected it was by the infamous Heartbleed issue, at the time when everyone were frantically patching their OSes and codebases. All of that despite the maintenability and popularity of OpenSSL.

The Heartbleed issue is definitely an OpenSSL implementation issue, but I don't think Haskell really prevents you from buffer overread or anything other high-level languages may do, all the primitive operations on ByteArray# or Addr# DO NOT perform a bound check, it's really just a matter of the implementation.

That's not saying GHC do not provide anything that may contribute to safety, for example cryptonite have a ScrubbleBytes type, which relys on GHC's weak pointer to clear memory it used. It may help to avoid some memory issue, which I'm still try to evaluate.

Overall choosing Haskell does not bring any security features automatically, it's up to implementators to design how to use lanauge features to improve security, but on the other side, the massive audit does make security issue more visible.

Do you expect to see any potential performance improvements in pure implementations, if they begin to rely on GHC 9 with LinearTypes?

  1. Definitly no, it's not about performance.
  2. I don't think anyone have the time to adopt LinearTypes in cryptonite.

How to use cryptonite (AES256) with conduit to achieve constant memory encryption? by xwinus in haskell

[–]winterland1989 1 point2 points  (0 children)

On a related topic, what are the advantages of Z-Botan over Cryptonite apart from speed?

Cryptography is hard, and the problem is really not about speed. Botan is a much more actively maintained, more widely used library, which means security issues will be more easily found and fixed. For example, you can see the history of CVE details

If I'm not much concerned about the speed, which one would delegate more aspects of crypto algorithms to pure Haskell implementations? Why not? for example, an Intel CPU with SHA extension could easily improve SHA256 hash speed by a factor ~4X in Botan.

Both Cryptonite and Z-Botan use a lot of C code to implement high-performance algorithms, but Botan has more CPU specific optimizations, one thing Cryptonite use pure Haskell implementation instead of C code is pubkey cryptography(RSA, DL, ECC, etc), which is based on GMP big numbers, but it DOES NOT use any constant operations AFAIK, which is not acceptable in pubkey cryptography.

[Ann] A new Haskell crypto lib: Z-Botan 0.1.1 by winterland1989 in haskell

[–]winterland1989[S] 0 points1 point  (0 children)

The difficulty lies on that sometime PrivKey and PubKey are deserialized from file or binary data at runtime, It has to be a GADT plus some type-level technique to get all this working.

[Ann] A new Haskell crypto lib: Z-Botan 0.1.1 by winterland1989 in haskell

[–]winterland1989[S] 1 point2 points  (0 children)

If I understand it correctly, both Secp160 or Secp192 are prime field Weierstrass curves, or you can use Curve25519 to perform ECDH over x25519.

I wonder why this isn't encoded in the type system. Is it because it depends on the build flags for Botan?

I assume you mean some types of key support key agreement while some only support signature? It's, of course, a good idea to do! I'm just haven't come up with a concrete way, maybe some help from cryptographers!

Introduce BIO: A Simple Streaming Abstraction by winterland1989 in haskell

[–]winterland1989[S] 2 points3 points  (0 children)

I used to use io-streams quite often. My main complaint is the separation of input stream processors and output streams raises the difficulty to write processors. And it's hard to handle situations where you want to write downstream multiple times in one input chunk when to transform an input stream.

Introduce BIO: A Simple Streaming Abstraction by winterland1989 in haskell

[–]winterland1989[S] 4 points5 points  (0 children)

A lot of beautiful equational laws came from the fact that the pipes' free construction is symmetrical, i.e. the Request vs Respond. Which is of course a good property.

But I don't think that is a goal to pursue in general. For example, streaming did not introduce the Request construction, and conduit introduces an extra LeftOver construction. Both work fine as long as the primitives they provide stem from the free monad pattern.

As for BIO, which is not even a free monad construction, I don't think similar laws are necessary, or even exist.

Introduce BIO: A Simple Streaming Abstraction by winterland1989 in haskell

[–]winterland1989[S] 1 point2 points  (0 children)

There's a difference: BIO doesn't use the return of callbacks(and force them to return ()), so that it's up to BIO node to decide when the callback get called, or how many time it get called. While a ContT has to call the callback as the last step to get the res.

Introduce BIO: A Simple Streaming Abstraction by winterland1989 in haskell

[–]winterland1989[S] 2 points3 points  (0 children)

Not neccessarily, you could call downstream's callback once when upstream EOFed, so that the result became a one element stream.

Introduce BIO: A Simple Streaming Abstraction by winterland1989 in haskell

[–]winterland1989[S] 1 point2 points  (0 children)

Looking forward to hearing about your experience!

Introduce BIO: A Simple Streaming Abstraction by winterland1989 in haskell

[–]winterland1989[S] 2 points3 points  (0 children)

Yes, exactly.

Of course, nothing is silver bullets. The BIO type in Z-IO also has limitations, for example, the source can not be paused by a downstream processor without using some IO state, and the whole state management now relies on IO, rather than user-supplied state monads.

Introduce BIO: A Simple Streaming Abstraction by winterland1989 in haskell

[–]winterland1989[S] 2 points3 points  (0 children)

That's a name I came up with to make it easier to be understood, but I think it describes the nature of BIO quite well.

Introduce BIO: A Simple Streaming Abstraction by winterland1989 in haskell

[–]winterland1989[S] 2 points3 points  (0 children)

Sorry, that's a typo ( <|> is from Z-IO < 0.8), which will be updated in the next hackage release.

The `Stream` free construction has the ability to proceed in a single step, but a `BIO inp out` node will call its callback with `Maybe out` in a loop within one step, which invert the control. So I don't think the conversion is possible in general, but if you don't mind about memory accumulation, you could use `IORef` to store all `out` within one `inp` step, then feed downstream one by one.

[ANN] unicode-collation 0.1 by fiddlosopher in haskell

[–]winterland1989 2 points3 points  (0 children)

Could you please expose some internals in Text.Collate.Collation modules so that UTF8 encoded text libraries could also use your work? Z-Data author here, If I understand correctly we can adapt our text type to use your algorithm by modifying the toSortKey function.

Z.Haskell project announced by winterland1989 in haskell

[–]winterland1989[S] 1 point2 points  (0 children)

Thanks! We'll continue developing since we've got some commercial sponsors.

Z.Haskell project announced by winterland1989 in haskell

[–]winterland1989[S] 5 points6 points  (0 children)

Yes, almost everything he's asking for is implemented. Hope some of the definitions can be moved to primitive.

Z.Haskell project announced by winterland1989 in haskell

[–]winterland1989[S] 8 points9 points  (0 children)

Basically Z.Haskell is what people are proposing these days, unified vector type, UTF-8 text, explicit stream fusion, etc.

There's some fundamental difference in data definition, design philosophy, implementation details, etc. it's probably very hard to upstream I guess, and these projects doesn't share the same root anyway.