Argon2 in Pure Nim.

2024-01-28 Thread xioren
This is a project I did mostly for fun and to be able to implement Argon2 into some other projects I have, like a file encryption script. If I made a Nimble package people might think this is production ready which it is not. I lack to knowledge of Nim to truly optimize the code and I lack the e

Argon2 in Pure Nim.

2024-01-28 Thread xTrayambak
Awesome! I've been trying to come up with my own Argon implementation, but I've never been able to finish it off. I'd like to ask though, why not make this a proper Nimble package instead of just Nim files scattered in a repository?

Argon2 in Pure Nim.

2024-01-25 Thread xioren
Okay that makes sense thank you. So it's a question of efficiency rather than correctness. I will look into threadpool.

Argon2 in Pure Nim.

2024-01-25 Thread mratsim
You're creating `timeCost *syncPoint*parallelism` threads. Creating a thread is very costly and need to be amortized, a threadpool reuses them. You can do at least 5 xor-shift-rotate-add while waiting for the OS to create a _[single](https://forum.nim-lang.org/postActivity.xml#single) thread

Argon2 in Pure Nim.

2024-01-25 Thread xioren
Sorry to belabor the point but getting this right is important to me and I am unable to verify what you guys are saying. I really can't see how using createThread is giving me the WRONG number of threads. From the documentation: import std/locks var thr: array[0..4, T

Argon2 in Pure Nim.

2024-01-24 Thread Araq
> Does the difference in behavior mean I am ending up with a different number > of threads (as mratsim suggested) given the analogous code? Yes, it does mean that.

Argon2 in Pure Nim.

2024-01-24 Thread xioren
@araq So if the behavior of createThread is not 1:1 analogous to Go's go routine, that doesn't bother me so long as it doesn't impact the implementation of the algorithm. Does the difference in behavior mean I am ending up with a different number of threads (as mratsim suggested) given the analo

Argon2 in Pure Nim.

2024-01-23 Thread Araq
Yes, it works very differently. Golang's `go` keyword is roughly Nim's `spawn` as provided by a thread pool library (Weave, Malebolgia) and not `createThread`.

Argon2 in Pure Nim.

2024-01-23 Thread xioren
@arnetheduck Ah I should have know cheatfate would have already implemented this. Thanks. @mratsim Thanks for the input. I started with threadpool but moved away as its listed as deprecated. My logic here is basically strait from Google's Go implementation: for n := uint32(0); n <

Argon2 in Pure Nim.

2024-01-23 Thread mratsim
Quick comments after skimming. * First of all, good job debugging cryptography is quite annoying. * You will likely want to switch to a threadpool, you are creating way too many threads here, it's slow and will oversubscribed your system:

Argon2 in Pure Nim.

2024-01-23 Thread arnetheduck
Here's one with you can compare with:

Argon2 in Pure Nim.

2024-01-22 Thread xioren
Just wrapped up implementing Argon2 in Nim. This was mostly as a learning experience and this is not production ready code. It lacks optimizations and security considerations. As far as I can tell this is the only Nim implementation. Hopefully someone smarter and more proficient at Nim than me