OSDN Git Service

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