diff options
| author | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
| commit | 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch) | |
| tree | 158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/go/crypto%2Fed25519%2Findex.html | |
| parent | 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff) | |
| download | dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip | |
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/go/crypto%2Fed25519%2Findex.html')
| -rw-r--r-- | devdocs/go/crypto%2Fed25519%2Findex.html | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/devdocs/go/crypto%2Fed25519%2Findex.html b/devdocs/go/crypto%2Fed25519%2Findex.html deleted file mode 100644 index 0a2ce4fa7..000000000 --- a/devdocs/go/crypto%2Fed25519%2Findex.html +++ /dev/null @@ -1,90 +0,0 @@ -<h1> Package ed25519 </h1> <ul id="short-nav"> -<li><code>import "crypto/ed25519"</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 ed25519 implements the Ed25519 signature algorithm. See <a href="https://ed25519.cr.yp.to/">https://ed25519.cr.yp.to/</a>. </p> -<p>These functions are also compatible with the “Ed25519” function defined in RFC 8032. However, unlike RFC 8032's formulation, this package's private key representation includes a public key suffix to make multiple signing operations with the same key more efficient. This package refers to the RFC 8032 private key as the “seed”. </p> <h4 id="example__ed25519ctx"> <span class="text">Example (Ed25519ctx)</span> -</h4> <p>Code:</p> <pre class="code" data-language="go"> -pub, priv, err := GenerateKey(nil) -if err != nil { - log.Fatal(err) -} - -msg := []byte("The quick brown fox jumps over the lazy dog") - -sig, err := priv.Sign(nil, msg, &Options{ - Context: "Example_ed25519ctx", -}) -if err != nil { - log.Fatal(err) -} - -if err := VerifyWithOptions(pub, msg, sig, &Options{ - Context: "Example_ed25519ctx", -}); err != nil { - log.Fatal("invalid signature") -} -</pre> <h2 id="pkg-index">Index </h2> <ul id="manual-nav"> -<li><a href="#pkg-constants">Constants</a></li> -<li><a href="#GenerateKey">func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error)</a></li> -<li><a href="#Sign">func Sign(privateKey PrivateKey, message []byte) []byte</a></li> -<li><a href="#Verify">func Verify(publicKey PublicKey, message, sig []byte) bool</a></li> -<li><a href="#VerifyWithOptions">func VerifyWithOptions(publicKey PublicKey, message, sig []byte, opts *Options) error</a></li> -<li><a href="#Options">type Options</a></li> -<li> <a href="#Options.HashFunc">func (o *Options) HashFunc() crypto.Hash</a> -</li> -<li><a href="#PrivateKey">type PrivateKey</a></li> -<li> <a href="#NewKeyFromSeed">func NewKeyFromSeed(seed []byte) PrivateKey</a> -</li> -<li> <a href="#PrivateKey.Equal">func (priv PrivateKey) Equal(x crypto.PrivateKey) bool</a> -</li> -<li> <a href="#PrivateKey.Public">func (priv PrivateKey) Public() crypto.PublicKey</a> -</li> -<li> <a href="#PrivateKey.Seed">func (priv PrivateKey) Seed() []byte</a> -</li> -<li> <a href="#PrivateKey.Sign">func (priv PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) (signature []byte, err error)</a> -</li> -<li><a href="#PublicKey">type PublicKey</a></li> -<li> <a href="#PublicKey.Equal">func (pub PublicKey) Equal(x crypto.PublicKey) bool</a> -</li> -</ul> <div id="pkg-examples"> <h3>Examples</h3> <dl> <dd><a class="exampleLink" href="#example__ed25519ctx">Package (Ed25519ctx)</a></dd> </dl> </div> <h3>Package files</h3> <p> <span>ed25519.go</span> </p> <h2 id="pkg-constants">Constants</h2> <pre data-language="go">const ( - // PublicKeySize is the size, in bytes, of public keys as used in this package. - PublicKeySize = 32 - // PrivateKeySize is the size, in bytes, of private keys as used in this package. - PrivateKeySize = 64 - // SignatureSize is the size, in bytes, of signatures generated and verified by this package. - SignatureSize = 64 - // SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032. - SeedSize = 32 -)</pre> <h2 id="GenerateKey">func <span>GenerateKey</span> <span title="Added in Go 1.13">1.13</span> </h2> <pre data-language="go">func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error)</pre> <p>GenerateKey generates a public/private key pair using entropy from rand. If rand is nil, <span>crypto/rand.Reader</span> will be used. </p> -<p>The output of this function is deterministic, and equivalent to reading <a href="#SeedSize">SeedSize</a> bytes from rand, and passing them to <a href="#NewKeyFromSeed">NewKeyFromSeed</a>. </p> -<h2 id="Sign">func <span>Sign</span> <span title="Added in Go 1.13">1.13</span> </h2> <pre data-language="go">func Sign(privateKey PrivateKey, message []byte) []byte</pre> <p>Sign signs the message with privateKey and returns a signature. It will panic if len(privateKey) is not <a href="#PrivateKeySize">PrivateKeySize</a>. </p> -<h2 id="Verify">func <span>Verify</span> <span title="Added in Go 1.13">1.13</span> </h2> <pre data-language="go">func Verify(publicKey PublicKey, message, sig []byte) bool</pre> <p>Verify reports whether sig is a valid signature of message by publicKey. It will panic if len(publicKey) is not <a href="#PublicKeySize">PublicKeySize</a>. </p> -<h2 id="VerifyWithOptions">func <span>VerifyWithOptions</span> <span title="Added in Go 1.20">1.20</span> </h2> <pre data-language="go">func VerifyWithOptions(publicKey PublicKey, message, sig []byte, opts *Options) error</pre> <p>VerifyWithOptions reports whether sig is a valid signature of message by publicKey. A valid signature is indicated by returning a nil error. It will panic if len(publicKey) is not <a href="#PublicKeySize">PublicKeySize</a>. </p> -<p>If opts.Hash is <span>crypto.SHA512</span>, the pre-hashed variant Ed25519ph is used and message is expected to be a SHA-512 hash, otherwise opts.Hash must be <span>crypto.Hash</span>(0) and the message must not be hashed, as Ed25519 performs two passes over messages to be signed. </p> -<h2 id="Options">type <span>Options</span> <span title="Added in Go 1.20">1.20</span> </h2> <p>Options can be used with <a href="#PrivateKey.Sign">PrivateKey.Sign</a> or <a href="#VerifyWithOptions">VerifyWithOptions</a> to select Ed25519 variants. </p> -<pre data-language="go">type Options struct { - // Hash can be zero for regular Ed25519, or crypto.SHA512 for Ed25519ph. - Hash crypto.Hash - - // Context, if not empty, selects Ed25519ctx or provides the context string - // for Ed25519ph. It can be at most 255 bytes in length. - Context string -} -</pre> <h3 id="Options.HashFunc">func (*Options) <span>HashFunc</span> <span title="Added in Go 1.20">1.20</span> </h3> <pre data-language="go">func (o *Options) HashFunc() crypto.Hash</pre> <p>HashFunc returns o.Hash. </p> -<h2 id="PrivateKey">type <span>PrivateKey</span> <span title="Added in Go 1.13">1.13</span> </h2> <p>PrivateKey is the type of Ed25519 private keys. It implements <span>crypto.Signer</span>. </p> -<pre data-language="go">type PrivateKey []byte</pre> <h3 id="NewKeyFromSeed">func <span>NewKeyFromSeed</span> <span title="Added in Go 1.13">1.13</span> </h3> <pre data-language="go">func NewKeyFromSeed(seed []byte) PrivateKey</pre> <p>NewKeyFromSeed calculates a private key from a seed. It will panic if len(seed) is not <a href="#SeedSize">SeedSize</a>. This function is provided for interoperability with RFC 8032. RFC 8032's private keys correspond to seeds in this package. </p> -<h3 id="PrivateKey.Equal">func (PrivateKey) <span>Equal</span> <span title="Added in Go 1.15">1.15</span> </h3> <pre data-language="go">func (priv PrivateKey) Equal(x crypto.PrivateKey) bool</pre> <p>Equal reports whether priv and x have the same value. </p> -<h3 id="PrivateKey.Public">func (PrivateKey) <span>Public</span> <span title="Added in Go 1.13">1.13</span> </h3> <pre data-language="go">func (priv PrivateKey) Public() crypto.PublicKey</pre> <p>Public returns the <a href="#PublicKey">PublicKey</a> corresponding to priv. </p> -<h3 id="PrivateKey.Seed">func (PrivateKey) <span>Seed</span> <span title="Added in Go 1.13">1.13</span> </h3> <pre data-language="go">func (priv PrivateKey) Seed() []byte</pre> <p>Seed returns the private key seed corresponding to priv. It is provided for interoperability with RFC 8032. RFC 8032's private keys correspond to seeds in this package. </p> -<h3 id="PrivateKey.Sign">func (PrivateKey) <span>Sign</span> <span title="Added in Go 1.13">1.13</span> </h3> <pre data-language="go">func (priv PrivateKey) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) (signature []byte, err error)</pre> <p>Sign signs the given message with priv. rand is ignored and can be nil. </p> -<p>If opts.HashFunc() is <span>crypto.SHA512</span>, the pre-hashed variant Ed25519ph is used and message is expected to be a SHA-512 hash, otherwise opts.HashFunc() must be <span>crypto.Hash</span>(0) and the message must not be hashed, as Ed25519 performs two passes over messages to be signed. </p> -<p>A value of type <a href="#Options">Options</a> can be used as opts, or crypto.Hash(0) or crypto.SHA512 directly to select plain Ed25519 or Ed25519ph, respectively. </p> -<h2 id="PublicKey">type <span>PublicKey</span> <span title="Added in Go 1.13">1.13</span> </h2> <p>PublicKey is the type of Ed25519 public keys. </p> -<pre data-language="go">type PublicKey []byte</pre> <h3 id="PublicKey.Equal">func (PublicKey) <span>Equal</span> <span title="Added in Go 1.15">1.15</span> </h3> <pre data-language="go">func (pub PublicKey) Equal(x crypto.PublicKey) bool</pre> <p>Equal reports whether pub and x have the same value. </p><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/ed25519/" class="_attribution-link">http://golang.org/pkg/crypto/ed25519/</a> - </p> -</div> |
