# \[ANN\] CryptoGroups, CryptoSignatures, DiffieHellman, SecureIO, Multiplexers

**URL:** <https://discourse.julialang.org/t/ann-cryptogroups-cryptosignatures-diffiehellman-secureio-multiplexers/32176>\
**Category:** Package Announcements\
**Tags:** cryptography\
**Created:** [December 11, 2019, 10:43pm UTC](https://discourse.julialang.org/t/ann-cryptogroups-cryptosignatures-diffiehellman-secureio-multiplexers/32176 "2019-12-11T22:43:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Janis\_Erdmanis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/janis_erdmanis/32/10869_2.png) [@Janis\_Erdmanis](https://discourse.julialang.org/u/Janis_Erdmanis)\
**Post date:** [December 11, 2019, 10:43pm UTC](https://discourse.julialang.org/t/ann-cryptogroups-cryptosignatures-diffiehellman-secureio-multiplexers/32176/1 "2019-12-11T22:43:18Z")

</div>

Hello everyone!

I have been persistently prototyping a new kind of electronic voting system (see [SynchronicBallot.jl](https://github.com/PeaceFounder/SynchronicBallot.jl)) which produced commonly used cryptographic tools along the way. I am a theoretical physicist, and I know little about cryptography thus don’t use these libraries in critical systems. They could be useful for learning some cryptography as most of them follow Wikipedia entries and do not contain much or very intelligent code. The APIs had been tested with some length and thus could be useful for prototyping.

## [CryptoGroups](https://github.com/PeaceFounder/CryptoGroups.jl)

A library which I developed for trying to implement a Diffie-Hellman key exchange algorithm. I started with learning a little bit about prime groups that there is a discrete log problem, etc. and thus made abstraction which made Diffie-Hellman protocol to be more straightforward. Googled some prime groups, wrote them in the code and tested their cyclic and prime property. I also managed to wrap `ECC` as a cryptographic group which I tested for a cyclic property.

## [CryoptoSignatures](https://github.com/PeaceFounder/CryptoSignatures.jl)

There are many types of cryptographic signatures, which I plan to develop here. Currently, only the DSA algorithm is implemented as reference taking Wikipedia and `ECC` which could suffer from a timing attack. Fortunately, that seems to be easily solvable by juicing in some `@async`s and `Channel`s for background computations and making the line `s=mod(kinv*(h + x*r),G)` constant in time for any x.

## [DiffieHellman](https://github.com/PeaceFounder/DiffieHellman.jl)

A simple Diffie-Hellman key exchange for a socket which can serialize and deserialize data. A cryptographic signature algorithm must be provided with `sign` and `verify` methods for avoiding a man in the middle attacks. In future perhaps the serialization of the cryptographic group is going to be taken out of the function.

## [SecureIO](https://github.com/PeaceFounder/SecureIO.jl)

When both ends had agreed on the key, they would like to use one needs a way to encrypt the socket. `SecureSerializer` is precisely for that purpose which uses SHA256 for calculating 32 byte key and AES256 for encryption/decryption. `SecureSerializer` was made with composability in mind so one could make onion protocols, etc.

## [Multiplexers](https://github.com/PeaceFounder/Multiplexers.jl)

A library to split a single socket into multiple ones with a `Multiplexer` type. Offers also a method for forwarding multiple sockets into a single socket. To use it together with `SecureIO` one needs to write a [boilerplate](https://github.com/PeaceFounder/SynchronicBallot.jl/blob/master/src/SynchronicBallot.jl). In this way, one can swap `Serialization` with JSON or some other serializer.

All these libraries suffer from a low performance as the code is currently is rather dynamic. One of the biggest problems is `deserialize` method since the compiler lacks thelepathical powers. The documentation is lacking, and I don’t see time for writing that anytime soon. Nevertheless, I would be happy to help here or on Slack 🙂

---

<div class="post-metadata">

**Author:** ![kirtsar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirtsar/32/7222_2.png) [@kirtsar](https://discourse.julialang.org/u/kirtsar)\
**Post date:** [December 12, 2019, 9:40pm UTC](https://discourse.julialang.org/t/ann-cryptogroups-cryptosignatures-diffiehellman-secureio-multiplexers/32176/2 "2019-12-12T21:40:03Z")

</div>

Maybe you would be interested in the computational algebra packages, such as:

1. [https://github.com/wbhart/AbstractAlgebra.jl](https://github.com/wbhart/AbstractAlgebra.jl) (general algebraic structures interfaces, Rings, Fields, etc)
2. [Getting Started · Nemo.jl](http://nemocas.github.io/Nemo.jl/latest/) (implementation of Galois fields and many many more)
3. [https://github.com/thofma/Hecke.jl](https://github.com/thofma/Hecke.jl) (a LOT of algebraic number theory with elliptic curves over finite fields)

You should definitely check how they treat fields vs field elements, parent objects, etc, i think it helpful.

---

<div class="post-metadata">

**Author:** ![Janis\_Erdmanis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/janis_erdmanis/32/10869_2.png) [@Janis\_Erdmanis](https://discourse.julialang.org/u/Janis_Erdmanis)\
**Post date:** [December 12, 2019, 11:39pm UTC](https://discourse.julialang.org/t/ann-cryptogroups-cryptosignatures-diffiehellman-secureio-multiplexers/32176/3 "2019-12-12T23:39:50Z")

</div>

Yeah, I still don’t have a clue what they can do. Number theory feels to be too dry for a humble theoretical physicist who does Taylor series most of the time 😇
