github.com/vipernet-xyz/tm@v0.34.24/crypto/doc.go (about)

     1  // crypto is a customized/convenience cryptography package for supporting
     2  // Tendermint.
     3  
     4  // It wraps select functionality of equivalent functions in the
     5  // Go standard library, for easy usage with our libraries.
     6  
     7  // Keys:
     8  
     9  // All key generation functions return an instance of the PrivKey interface
    10  // which implements methods
    11  
    12  //     AssertIsPrivKeyInner()
    13  //     Bytes() []byte
    14  //     Sign(msg []byte) Signature
    15  //     PubKey() PubKey
    16  //     Equals(PrivKey) bool
    17  //     Wrap() PrivKey
    18  
    19  // From the above method we can:
    20  // a) Retrieve the public key if needed
    21  
    22  //     pubKey := key.PubKey()
    23  
    24  // For example:
    25  //     privKey, err := ed25519.GenPrivKey()
    26  //     if err != nil {
    27  // 	...
    28  //     }
    29  //     pubKey := privKey.PubKey()
    30  //     ...
    31  //     // And then you can use the private and public key
    32  //     doSomething(privKey, pubKey)
    33  
    34  // We also provide hashing wrappers around algorithms:
    35  
    36  // Sha256
    37  //     sum := crypto.Sha256([]byte("This is Tendermint"))
    38  //     fmt.Printf("%x\n", sum)
    39  
    40  package crypto
    41  
    42  // TODO: Add more docs in here