diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/go/crypto%2Fdes%2Findex.html | |
new repository
Diffstat (limited to 'devdocs/go/crypto%2Fdes%2Findex.html')
| -rw-r--r-- | devdocs/go/crypto%2Fdes%2Findex.html | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/devdocs/go/crypto%2Fdes%2Findex.html b/devdocs/go/crypto%2Fdes%2Findex.html new file mode 100644 index 00000000..1a7845ae --- /dev/null +++ b/devdocs/go/crypto%2Fdes%2Findex.html @@ -0,0 +1,38 @@ +<h1> Package des </h1> <ul id="short-nav"> +<li><code>import "crypto/des"</code></li> +<li><a href="#pkg-overview" class="overviewLink">Overview</a></li> +<li><a href="#pkg-index" class="indexLink">Index</a></li> +<li><a href="#pkg-examples" class="examplesLink">Examples</a></li> +</ul> <h2 id="pkg-overview">Overview </h2> <p>Package des implements the Data Encryption Standard (DES) and the Triple Data Encryption Algorithm (TDEA) as defined in U.S. Federal Information Processing Standards Publication 46-3. </p> +<p>DES is cryptographically broken and should not be used for secure applications. </p> <h2 id="pkg-index">Index </h2> <ul id="manual-nav"> +<li><a href="#pkg-constants">Constants</a></li> +<li><a href="#NewCipher">func NewCipher(key []byte) (cipher.Block, error)</a></li> +<li><a href="#NewTripleDESCipher">func NewTripleDESCipher(key []byte) (cipher.Block, error)</a></li> +<li><a href="#KeySizeError">type KeySizeError</a></li> +<li> <a href="#KeySizeError.Error">func (k KeySizeError) Error() string</a> +</li> +</ul> <div id="pkg-examples"> <h3>Examples</h3> <dl> <dd><a class="exampleLink" href="#example_NewTripleDESCipher">NewTripleDESCipher</a></dd> </dl> </div> <h3>Package files</h3> <p> <span>block.go</span> <span>cipher.go</span> <span>const.go</span> </p> <h2 id="pkg-constants">Constants</h2> <p>The DES block size in bytes. </p> +<pre data-language="go">const BlockSize = 8</pre> <h2 id="NewCipher">func <span>NewCipher</span> </h2> <pre data-language="go">func NewCipher(key []byte) (cipher.Block, error)</pre> <p>NewCipher creates and returns a new <span>cipher.Block</span>. </p> +<h2 id="NewTripleDESCipher">func <span>NewTripleDESCipher</span> </h2> <pre data-language="go">func NewTripleDESCipher(key []byte) (cipher.Block, error)</pre> <p>NewTripleDESCipher creates and returns a new <span>cipher.Block</span>. </p> <h4 id="example_NewTripleDESCipher"> <span class="text">Example</span> +</h4> <p>Code:</p> <pre class="code" data-language="go"> +// NewTripleDESCipher can also be used when EDE2 is required by +// duplicating the first 8 bytes of the 16-byte key. +ede2Key := []byte("example key 1234") + +var tripleDESKey []byte +tripleDESKey = append(tripleDESKey, ede2Key[:16]...) +tripleDESKey = append(tripleDESKey, ede2Key[:8]...) + +_, err := des.NewTripleDESCipher(tripleDESKey) +if err != nil { + panic(err) +} + +// See crypto/cipher for how to use a cipher.Block for encryption and +// decryption. +</pre> <h2 id="KeySizeError">type <span>KeySizeError</span> </h2> <pre data-language="go">type KeySizeError int</pre> <h3 id="KeySizeError.Error">func (KeySizeError) <span>Error</span> </h3> <pre data-language="go">func (k KeySizeError) Error() string</pre><div class="_attribution"> + <p class="_attribution-p"> + © Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br> + <a href="http://golang.org/pkg/crypto/des/" class="_attribution-link">http://golang.org/pkg/crypto/des/</a> + </p> +</div> |
