Documentation ¶
Index ¶
- func CreateAESRSWPuzzleWithPrimes(a uint64, t uint64, message []byte, p *big.Int, q *big.Int) (ciphertext []byte, puzzle rsw.PuzzleRSW, err error)
- func CreatePuzzleAES(t uint64, message []byte, ...) (ciphertext []byte, puzzle crypto.Puzzle, err error)
- func CreatePuzzleRC5(t uint64, message []byte, ...) (ciphertext []byte, puzzle crypto.Puzzle, err error)
- func CreatePuzzleRC6(t uint64, message []byte, ...) (ciphertext []byte, puzzle crypto.Puzzle, err error)
- func CreateRC5RSWPuzzleWithPrimes(a uint64, t uint64, message []byte, p *big.Int, q *big.Int) (ciphertext []byte, puzzle rsw.PuzzleRSW, err error)
- func CreateRSW2048A2PuzzleAES(t uint64, message []byte) (ciphertext []byte, puzzle crypto.Puzzle, err error)
- func CreateRSW2048A2PuzzleECIES(t uint64, message []byte) (ciphertext []byte, puzzle crypto.Puzzle, err error)
- func CreateRSW2048A2PuzzleRC5(t uint64, message []byte) (ciphertext []byte, puzzle crypto.Puzzle, err error)
- func CreateRSW2048A2PuzzleRC6(t uint64, message []byte) (ciphertext []byte, puzzle crypto.Puzzle, err error)
- func CreateRSW2048A2PuzzleRSA(t uint64, message []byte) (ciphertext []byte, puzzle crypto.Puzzle, err error)
- func CreateSHAPuzzleAES(t uint64, message []byte) (ciphertext []byte, puzzle crypto.Puzzle, err error)
- func DecryptPuzzleAES(ciphertext []byte, key []byte) (message []byte, err error)
- func DecryptPuzzleRC5(ciphertext []byte, key []byte) (message []byte, err error)
- func Generate16ByteKey(rand io.Reader) (key []byte, err error)
- func GenerateIV(rand io.Reader, blockCipher cipher.Block) (iv []byte, err error)
- func SolvePuzzleAES(ciphertext []byte, puzzle crypto.Puzzle) (message []byte, err error)
- func SolvePuzzleECIES(ciphertext []byte, puzzle crypto.Puzzle) (message []byte, err error)
- func SolvePuzzleRC5(ciphertext []byte, puzzle crypto.Puzzle) (message []byte, err error)
- func SolvePuzzleRC6(ciphertext []byte, puzzle crypto.Puzzle) (message []byte, err error)
- func SolvePuzzleRSA(ciphertext []byte, puzzle crypto.Puzzle) (message []byte, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAESRSWPuzzleWithPrimes ¶
func CreateAESRSWPuzzleWithPrimes(a uint64, t uint64, message []byte, p *big.Int, q *big.Int) (ciphertext []byte, puzzle rsw.PuzzleRSW, err error)
CreateAESRSWPuzzleWithPrimes creates a RSW timelock puzzle with time t and encrypts the message using AES, given some user-defined primes. This returns a struct unlike the other methods here.
func CreatePuzzleAES ¶
func CreatePuzzleAES(t uint64, message []byte, puzzleCreator func(uint64, []byte) (crypto.Puzzle, []byte, error)) (ciphertext []byte, puzzle crypto.Puzzle, err error)
CreatePuzzleAES creates a RSW timelock puzzle with time t and encrypts the message using AES.
func CreatePuzzleRC5 ¶
func CreatePuzzleRC5(t uint64, message []byte, puzzleCreator func(uint64, []byte) (crypto.Puzzle, []byte, error)) (ciphertext []byte, puzzle crypto.Puzzle, err error)
CreatePuzzleRC5 creates a timelock puzzle with time t and encrypts the message using RC5.
func CreatePuzzleRC6 ¶
func CreatePuzzleRC6(t uint64, message []byte, puzzleCreator func(uint64, []byte) (crypto.Puzzle, []byte, error)) (ciphertext []byte, puzzle crypto.Puzzle, err error)
CreatePuzzleRC6 creates a timelock puzzle with time t and encrypts the message using RC6.
func CreateRC5RSWPuzzleWithPrimes ¶
func CreateRC5RSWPuzzleWithPrimes(a uint64, t uint64, message []byte, p *big.Int, q *big.Int) (ciphertext []byte, puzzle rsw.PuzzleRSW, err error)
CreateRC5RSWPuzzleWithPrimes creates a RSW timelock puzzle with time t and encrypts the message using RC5, given some user-defined primes. This returns a struct unlike the other methods here.
func CreateRSW2048A2PuzzleAES ¶
func CreateRSW2048A2PuzzleAES(t uint64, message []byte) (ciphertext []byte, puzzle crypto.Puzzle, err error)
CreateRSW2048A2PuzzleAES creates a RSW timelock puzzle with time t and encrypts the message using AES.
func CreateRSW2048A2PuzzleECIES ¶
func CreateRSW2048A2PuzzleECIES(t uint64, message []byte) (ciphertext []byte, puzzle crypto.Puzzle, err error)
CreateRSW2048A2PuzzleECIES creates a RSW timelock puzzle with time t and encrypts the message using ECIES. We're using seckp256k1. Here's our process because working with ethereum types is annoying and people seem to not like marshalling private keys Generate s256 ethcrypto ecdsa key -> use FromECDSA to create bytes with ethcrypto lib, convert to ecies privkey and encrypt message -> send that in puzzle -> once puzzle is solved, unmarshal to ecies privkey, use to decrypt
func CreateRSW2048A2PuzzleRC5 ¶
func CreateRSW2048A2PuzzleRC5(t uint64, message []byte) (ciphertext []byte, puzzle crypto.Puzzle, err error)
CreateRSW2048A2PuzzleRC5 creates a RSW timelock puzzle with time t and encrypts the message using RC5. This is consistent with the scheme described in RSW96.
func CreateRSW2048A2PuzzleRC6 ¶
func CreateRSW2048A2PuzzleRC6(t uint64, message []byte) (ciphertext []byte, puzzle crypto.Puzzle, err error)
CreateRSW2048A2PuzzleRC6 creates a RSW timelock puzzle with time t and encrypts the message using RC6.
func CreateRSW2048A2PuzzleRSA ¶
func CreateRSW2048A2PuzzleRSA(t uint64, message []byte) (ciphertext []byte, puzzle crypto.Puzzle, err error)
CreateRSW2048A2PuzzleRSA creates a RSW timelock puzzle with time t and encrypts the message using RSA. We marshal the key to PKCS1
func CreateSHAPuzzleAES ¶
func CreateSHAPuzzleAES(t uint64, message []byte) (ciphertext []byte, puzzle crypto.Puzzle, err error)
CreateSHAPuzzleAES creates a hash timelock puzzle with time t and encrypts the message using AES.
func DecryptPuzzleAES ¶
DecryptPuzzleAES decrypts the ciphertext using AES
func DecryptPuzzleRC5 ¶
DecryptPuzzleRC5 decrypts the ciphertext using RC5
func Generate16ByteKey ¶
Generate16ByteKey generates a 16 byte long key to be used for AES, RC5, or RC6 from a reader
func GenerateIV ¶
GenerateIV generates an initialization vector with the block size of the cipher
func SolvePuzzleAES ¶
SolvePuzzleAES solves the timelock puzzle and decrypts the ciphertext using AES
func SolvePuzzleECIES ¶
SolvePuzzleECIES solves the timelock puzzle and decrypts the ciphertext using ECIES. We assume the key is an ASN.1 ECPKS
func SolvePuzzleRC5 ¶
SolvePuzzleRC5 solves the timelock puzzle and decrypts the ciphertext using RC5
func SolvePuzzleRC6 ¶
SolvePuzzleRC6 solves the timelock puzzle and decrypts the ciphertext using RC6
Types ¶
This section is empty.