You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.0 KiB

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