tendermint/crypto/doc.go

46 lines
1.1 KiB
Go
Raw Normal View History

// crypto is a customized/convenience cryptography package for supporting
// Tendermint.
2018-06-20 15:30:44 -07:00
// It wraps select functionality of equivalent functions in the
// Go standard library, for easy usage with our libraries.
2018-06-20 15:30:44 -07:00
// Keys:
2018-06-20 15:30:44 -07:00
// All key generation functions return an instance of the PrivKey interface
// which implements methods
2018-06-20 15:30:44 -07:00
// AssertIsPrivKeyInner()
// Bytes() []byte
// Sign(msg []byte) Signature
// PubKey() PubKey
// Equals(PrivKey) bool
// Wrap() PrivKey
2018-06-20 15:30:44 -07:00
// From the above method we can:
// a) Retrieve the public key if needed
2018-06-20 15:30:44 -07:00
// pubKey := key.PubKey()
2018-06-20 15:30:44 -07:00
// For example:
// privKey, err := crypto.GenPrivKeyEd25519()
// if err != nil {
// ...
// }
// pubKey := privKey.PubKey()
// ...
// // And then you can use the private and public key
// doSomething(privKey, pubKey)
2018-06-20 15:30:44 -07:00
// We also provide hashing wrappers around algorithms:
2018-06-20 15:30:44 -07:00
// Sha256
// sum := crypto.Sha256([]byte("This is Tendermint"))
// fmt.Printf("%x\n", sum)
2018-06-20 15:30:44 -07:00
// Ripemd160
// sum := crypto.Ripemd160([]byte("This is consensus"))
// fmt.Printf("%x\n", sum)
2018-06-20 15:30:44 -07:00
package crypto
// TODO: Add more docs in here