Hack Forums
[C#] Encrypt - Decrypt file using chacha20 - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] Encrypt - Decrypt file using chacha20 (/showthread.php?tid=5959802)



Encrypt - Decrypt file using chacha20 - Iera Namhorun - Apr 13, 2019

does anyone know tutorial for simple encryption and decryption of a file using the chacha20 algorithm in c# that is easy to understand for beginners without bouncycastle library ?
I found this on Github but an error appeared when I imported it into Visual Studio ( https: // github . com /Datasilk/Crypto )


RE: Encrypt - Decrypt file using chacha20 - SIM-3547942 - Apr 13, 2019

What error did you get? Are you looking for a library for dotnet or dotnet core?

Need some more info. :)


RE: Encrypt - Decrypt file using chacha20 - Iera Namhorun - Apr 13, 2019

(Apr 13, 2019 03:16 AM)migado Wrote:  What error did you get? Are you looking for a library for dotnet or dotnet core?

Need some more info. :)

error appears in all class files, I use net framework 3.5 and want to try encryption and decryption using the chacha20 algorithm without the bouncy castle library.


RE: Encrypt - Decrypt file using chacha20 - gigajew - Apr 13, 2019

Here's the C++ source as from Wikipedia it should be pretty easy to translate to C#



As for the link you posted, all you have to do is retarget from .NET Core to .NET Framework. It's usually as easy as just copying the code into a new project.


RE: Encrypt - Decrypt file using chacha20 - SIM-3547942 - Apr 13, 2019

(Apr 13, 2019 06:57 AM)Iera Namhorun Wrote:  error appears in all class files, I use net framework 3.5 and want to try encryption and decryption using the chacha20 algorithm without the bouncy castle library.

Ouch, that .net Framework 3.5 requirement could be a serious issue..

- libsodium-net (https://github.com/adamcaudill/libsodium-net) requires dotnet framework 4.0..
- nsec (https://github.com/ektrah/nsec) is only available for dotnet core.

Not sure if it will fit your needs or it will work, but you could try the following library from Github and try to compile it againt 3.5:

https://github.com/sbennett1990/ChaCha20-csharp


RE: Encrypt - Decrypt file using chacha20 - Iera Namhorun - Apr 13, 2019

(Apr 13, 2019 08:33 AM)migado Wrote:  Ouch, that .net Framework 3.5 requirement could be a serious issue..

- libsodium-net (link) requires dotnet framework 4.0..
- nsec (link) is only available for dotnet core.

Not sure if it will fit your needs or it will work, but you could try the following library from Github and try to compile it againt 3.5:

[link]

owh, thankyou.
I do not know if it must use the net framework above 3.5


(Apr 13, 2019 08:28 AM)gigajew Wrote:  Here's the C++ source as from Wikipedia it should be pretty easy to translate to C#

[link]
As for the link you posted, all you have to do is retarget from .NET Core to .NET Framework.  It's usually as easy as just copying the code into a new project.

okay, I will try it


(Apr 13, 2019 08:28 AM)gigajew Wrote:  As for the link you posted, all you have to do is retarget from .NET Core to .NET Framework.  It's usually as easy as just copying the code into a new project.
but error still appears, I have changed to net framework 4.0 and 4.5
https://images2.imgbox.com/31/1f/fMavqHYT_o.png