SHA-256: Difference between revisions

Content added Content deleted
(Added the solution with "nimcrypto".)
Line 2,329: Line 2,329:


=={{header|Nim}}==
=={{header|Nim}}==
{{libheader|nimcrypto}}
Using the third party library <code>nimcrypto</code>, the program is very simple:

<lang Nim>import nimcrypto

echo sha256.digest("Rosetta code")</lang>

{{out}}
<pre>764FAF5C61AC315F1497F9DFA542713965B785E5CC2F707D6468D7D1124CDFCF</pre>

There is also the possibility to use directly a library such as OpenSSL. This is less convenient as we have to interface with a C library and to work with C types. Here is the way to go:

{{libheader|OpenSSL}}
{{libheader|OpenSSL}}