-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 87879e9
Showing
18 changed files
with
4,265 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<!-- This file is generated by Nim. --> | ||
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>src/nimword</title> | ||
|
||
<!-- Favicon --> | ||
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/> | ||
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII="> | ||
|
||
<!-- CSS --> | ||
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.1.1"> | ||
|
||
<!-- JS --> | ||
<script type="text/javascript" src="dochack.js?v=2.1.1"></script> | ||
</head> | ||
<body> | ||
<div class="document" id="documentId"> | ||
<div class="container"> | ||
<h1 class="title">src/nimword</h1> | ||
<div class="row"> | ||
<div class="three columns"> | ||
<div class="theme-select-wrapper"> | ||
<label for="theme-select">Theme: </label> | ||
<select id="theme-select" onchange="setTheme(this.value)"> | ||
<option value="auto">🌗 Match OS</option> | ||
<option value="dark">🌑 Dark</option> | ||
<option value="light">🌕 Light</option> | ||
</select> | ||
</div> | ||
<div id="global-links"> | ||
<ul class="simple"> | ||
<li><a id="indexLink" href="theindex.html">Index</a></li> | ||
</ul> | ||
</div> | ||
<div id="searchInputDiv"> | ||
Search: <input type="search" id="searchInput" oninput="search()"/> | ||
</div> | ||
<div> | ||
Group by: | ||
<select onchange="groupBy(this.value)"> | ||
<option value="section">Section</option> | ||
<option value="type">Type</option> | ||
</select> | ||
</div> | ||
<ul class="simple simple-toc" id="toc-list"> | ||
<li> | ||
<a class="reference reference-toplevel" href="#6" id="56">Imports</a> | ||
</li> | ||
<li> | ||
<details open> | ||
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary> | ||
<ul class="simple simple-toc-section"> | ||
<li><a class="reference" href="#NimwordHashingAlgorithm" title="NimwordHashingAlgorithm = enum | ||
nhaPbkdf2Sha256 = "pbkdf2_sha256", nhaPbkdf2Sha512 = "pbkdf2_sha512", | ||
nhaArgon2i = "argon2i", nhaArgon2id = "argon2id", nhaDefault">NimwordHashingAlgorithm</a></li> | ||
|
||
</ul> | ||
</details> | ||
</li> | ||
<li> | ||
<details open> | ||
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary> | ||
<ul class="simple simple-toc-section"> | ||
<ul class="simple nested-toc-section">hashEncodePassword | ||
<li><a class="reference" href="#hashEncodePassword%2CPassword%2Cint%2CNimwordHashingAlgorithm" title="hashEncodePassword(password: Password; iterations: int; | ||
algorithm: NimwordHashingAlgorithm = nhaDefault): string">hashEncodePassword(password: Password; iterations: int; | ||
algorithm: NimwordHashingAlgorithm = nhaDefault): string</a></li> | ||
|
||
</ul> | ||
<ul class="simple nested-toc-section">isValidPassword | ||
<li><a class="reference" href="#isValidPassword%2CPassword%2Cstring" title="isValidPassword(password: Password; encodedHash: string): bool">isValidPassword(password: Password; encodedHash: string): bool</a></li> | ||
|
||
</ul> | ||
|
||
</ul> | ||
</details> | ||
</li> | ||
<li> | ||
<a class="reference reference-toplevel" href="#19" id="69">Exports</a> | ||
</li> | ||
|
||
</ul> | ||
|
||
</div> | ||
<div class="nine columns" id="content"> | ||
<a href="https://github.com/PhilippMDoerner/nimword/tree/main/src/nimword.nim#L1" class="link-seesrc" target="_blank">Source</a> | ||
<a href="https://github.com/PhilippMDoerner/nimword/edit/devel/src/nimword.nim#L1" class="link-seesrc" target="_blank" >Edit</a> | ||
|
||
<div id="tocRoot"></div> | ||
|
||
<p class="module-desc"></p> | ||
<div class="section" id="6"> | ||
<h1><a class="toc-backref" href="#6">Imports</a></h1> | ||
<dl class="item"> | ||
<a class="reference external" href="nimword/argon2.html">nimword/argon2</a>, <a class="reference external" href="nimword/pbkdf2_sha256.html">nimword/pbkdf2_sha256</a>, <a class="reference external" href="nimword/pbkdf2_sha512.html">nimword/pbkdf2_sha512</a> | ||
</dl> | ||
</div> | ||
<div class="section" id="7"> | ||
<h1><a class="toc-backref" href="#7">Types</a></h1> | ||
<dl class="item"> | ||
<div id="NimwordHashingAlgorithm"> | ||
<dt><pre><a href="nimword.html#NimwordHashingAlgorithm"><span class="Identifier">NimwordHashingAlgorithm</span></a> <span class="Other">=</span> <span class="Keyword">enum</span> | ||
<span class="Identifier">nhaPbkdf2Sha256</span> <span class="Other">=</span> <span class="StringLit">"pbkdf2_sha256"</span><span class="Other">,</span> <span class="Identifier">nhaPbkdf2Sha512</span> <span class="Other">=</span> <span class="StringLit">"pbkdf2_sha512"</span><span class="Other">,</span> | ||
<span class="Identifier">nhaArgon2i</span> <span class="Other">=</span> <span class="StringLit">"argon2i"</span><span class="Other">,</span> <span class="Identifier">nhaArgon2id</span> <span class="Other">=</span> <span class="StringLit">"argon2id"</span><span class="Other">,</span> <span class="Identifier">nhaDefault</span></pre></dt> | ||
<dd> | ||
|
||
The number of different hashing algorithms nimword supports | ||
<a href="https://github.com/PhilippMDoerner/nimword/tree/main/src/nimword.nim#L10" class="link-seesrc" target="_blank">Source</a> | ||
<a href="https://github.com/PhilippMDoerner/nimword/edit/devel/src/nimword.nim#L10" class="link-seesrc" target="_blank" >Edit</a> | ||
|
||
</dd> | ||
</div> | ||
|
||
</dl> | ||
</div> | ||
<div class="section" id="12"> | ||
<h1><a class="toc-backref" href="#12">Procs</a></h1> | ||
<dl class="item"> | ||
<div id="hashEncodePassword-procs-all"> | ||
<div id="hashEncodePassword,Password,int,NimwordHashingAlgorithm"> | ||
<dt><pre><span class="Keyword">proc</span> <a href="#hashEncodePassword%2CPassword%2Cint%2CNimwordHashingAlgorithm"><span class="Identifier">hashEncodePassword</span></a><span class="Other">(</span><span class="Identifier">password</span><span class="Other">:</span> <a href="nimword/private/types.html#Password"><span class="Identifier">Password</span></a><span class="Other">;</span> <span class="Identifier">iterations</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> | ||
<span class="Identifier">algorithm</span><span class="Other">:</span> <a href="nimword.html#NimwordHashingAlgorithm"><span class="Identifier">NimwordHashingAlgorithm</span></a> <span class="Other">=</span> <span class="Identifier">nhaDefault</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {. | ||
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">SodiumError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> | ||
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> | ||
<dd> | ||
|
||
<p>Hashes and encodes the given password using the argon2 algorithm from libsodium.</p> | ||
<p>Returns the hash as part of a larger string containing hash, iterations, algorithm, salt and any further values used to calculate the hash. The pattern depends on the algorithm chosen.</p> | ||
<p>The return value can be used with <a class="reference external" href="#isValidPassword%2Cstring%2Cstring">isValidPassword</a> .</p> | ||
<p>The salt is randomly generated during the process.</p> | ||
<p>For guidance on choosing values for <tt class="docutils literal"><span class="pre"><span class="Identifier">iterations</span></span></tt> consult the <a class="reference external" href="https://doc.libsodium.org/password_hashing/default_phf#guidelines-for-choosing-the-parameters">libsodium-documentation</a></p> | ||
|
||
<a href="https://github.com/PhilippMDoerner/nimword/tree/main/src/nimword.nim#L20" class="link-seesrc" target="_blank">Source</a> | ||
<a href="https://github.com/PhilippMDoerner/nimword/edit/devel/src/nimword.nim#L20" class="link-seesrc" target="_blank" >Edit</a> | ||
|
||
</dd> | ||
</div> | ||
|
||
</div> | ||
<div id="isValidPassword-procs-all"> | ||
<div id="isValidPassword,Password,string"> | ||
<dt><pre><span class="Keyword">proc</span> <a href="#isValidPassword%2CPassword%2Cstring"><span class="Identifier">isValidPassword</span></a><span class="Other">(</span><span class="Identifier">password</span><span class="Other">:</span> <a href="nimword/private/types.html#Password"><span class="Identifier">Password</span></a><span class="Other">;</span> <span class="Identifier">encodedHash</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">{</span> | ||
<span class="Identifier">UnknownAlgorithmError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <a href="nimword/private/pbkdf2_utils.html#Pbkdf2Error"><span class="Identifier">Pbkdf2Error</span></a><span class="Other">,</span> <span class="Identifier">SodiumError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">}</span><span class="Other">,</span> | ||
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt> | ||
<dd> | ||
|
||
<p>Verifies that a given plain-text password can be used to generate the hash contained in <tt class="docutils literal"><span class="pre"><span class="Identifier">encodedHash</span></span></tt> with the parameters provided in <tt class="docutils literal"><span class="pre"><span class="Identifier">encodedHash</span></span></tt>.</p> | ||
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">encodedHash</span></span></tt> must be a string with the kind of pattern that <tt class="docutils literal"><span class="pre"><span class="Identifier">encodeHash</span></span></tt> procs or and <a class="reference external" href="#hashEncodePassword%2Cstring%2Cint">hashEncodePassword</a> generate.</p> | ||
<p>Raises UnknownAlgorithmError if the encoded hash string is for an algorithm not supported by nimword.</p> | ||
|
||
<a href="https://github.com/PhilippMDoerner/nimword/tree/main/src/nimword.nim#L50" class="link-seesrc" target="_blank">Source</a> | ||
<a href="https://github.com/PhilippMDoerner/nimword/edit/devel/src/nimword.nim#L50" class="link-seesrc" target="_blank" >Edit</a> | ||
|
||
</dd> | ||
</div> | ||
|
||
</div> | ||
|
||
</dl> | ||
</div> | ||
<div class="section" id="19"> | ||
<h1><a class="toc-backref" href="#19">Exports</a></h1> | ||
<dl class="item"> | ||
<a href="nimword/private/pbkdf2_utils.html#Pbkdf2Error"><span class="Identifier">Pbkdf2Error</span></a>, <a href="nimword/private/types.html#Password"><span class="Identifier">Password</span></a>, <a href="nimword/private/types.html#toPassword.c,string"><span class="Identifier">toPassword</span></a>, <a href="nimword/private/types.html#Hash"><span class="Identifier">Hash</span></a> | ||
</dl> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
<div class="twelve-columns footer"> | ||
<span class="nim-sprite"></span> | ||
<br> | ||
<small style="color: var(--hint);">Made with Nim. Generated: 2023-09-25 18:52:33 UTC</small> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<!-- Google fonts --> | ||
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/> | ||
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
nimTitle nimword nimword.html module src/nimword 0 | ||
nim nhaPbkdf2Sha256 nimword.html#nhaPbkdf2Sha256 NimwordHashingAlgorithm.nhaPbkdf2Sha256 10 | ||
nim nhaPbkdf2Sha512 nimword.html#nhaPbkdf2Sha512 NimwordHashingAlgorithm.nhaPbkdf2Sha512 10 | ||
nim nhaArgon2i nimword.html#nhaArgon2i NimwordHashingAlgorithm.nhaArgon2i 10 | ||
nim nhaArgon2id nimword.html#nhaArgon2id NimwordHashingAlgorithm.nhaArgon2id 10 | ||
nim nhaDefault nimword.html#nhaDefault NimwordHashingAlgorithm.nhaDefault 10 | ||
nim NimwordHashingAlgorithm nimword.html#NimwordHashingAlgorithm enum NimwordHashingAlgorithm 10 | ||
nim hashEncodePassword nimword.html#hashEncodePassword,Password,int,NimwordHashingAlgorithm proc hashEncodePassword(password: Password; iterations: int;\n algorithm: NimwordHashingAlgorithm = nhaDefault): string 20 | ||
nim isValidPassword nimword.html#isValidPassword,Password,string proc isValidPassword(password: Password; encodedHash: string): bool 50 |
Oops, something went wrong.