func SolvePuzzleAES(ciphertext []byte, puzzle crypto.Puzzle) (message []byte, err error) {
	if puzzle == nil {
		err = fmt.Errorf("Puzzle cannot be nil, what are you solving")
		return
	}

	var key []byte
	if key, err = puzzle.Solve(); err != nil {
		err = fmt.Errorf("Error solving auction puzzle: %s", err)
		return
	}

	var AESCipher cipher.Block
	if AESCipher, err = aes.NewCipher(key); err != nil {
		err = fmt.Errorf("Could not create new aes cipher for puzzle: %s", err)
		return
	}

	// check to make sure we're going to succeed when decrypting
	if len(ciphertext) < AESCipher.BlockSize() {
		err = fmt.Errorf("ciphertext less than blocksize, make a bigger ciphertext")
		return
	}

	// Split up IV into ciphertext and IV
	var iv []byte
	iv = ciphertext[:AESCipher.BlockSize()]

	// Don't decrypt the IV
	ciphertext = ciphertext[AESCipher.BlockSize():]

	// Make decrypter
	var cfbDecrypter cipher.Stream
	cfbDecrypter = cipher.NewCFBDecrypter(AESCipher, iv)

	// make message and then decrypt
	message = make([]byte, len(ciphertext))

	cfbDecrypter.XORKeyStream(message, ciphertext)

	return
}
// SolvePuzzleAES solves the timelock puzzle and decrypts the ciphertext using AES
SolvePuzzleAES solves the timelock puzzle and decrypts the ciphertext using AES
// SolvePuzzleAES solves the timelock puzzle and decrypts the ciphertext using AES
func SolvePuzzleAES(ciphertext []byte, puzzle crypto.Puzzle) (message []byte, err error) {
	if puzzle == nil {
		err = fmt.Errorf("Puzzle cannot be nil, what are you solving")
		return
	}
	var key []byte
	if key, err = puzzle.Solve(); err != nil {
		err = fmt.Errorf("Error solving auction puzzle: %s", err)
		return
	}
	var AESCipher cipher.Block
	if AESCipher, err = aes.NewCipher(key); err != nil {
		err = fmt.Errorf("Could not create new aes cipher for puzzle: %s", err)
		return
	}
	if len(ciphertext) < AESCipher.BlockSize() {
		err = fmt.Errorf("ciphertext less than blocksize, make a bigger ciphertext")
		return
	}
	var iv []byte
	iv = ciphertext[:AESCipher.BlockSize()]
	ciphertext = ciphertext[AESCipher.BlockSize():]
	var cfbDecrypter cipher.Stream
	cfbDecrypter = cipher.NewCFBDecrypter(AESCipher, iv)
	message = make([]byte, len(ciphertext))
	cfbDecrypter.XORKeyStream(message, ciphertext)
	return
}
func SolvePuzzleAES ( ciphertext [ ] byte , puzzle crypto . Puzzle ) ( message [ ] byte , err error ) { if puzzle == nil { err = fmt . Errorf ( " " ) return } var key [ ] byte if key , err = puzzle . Solve ( ) ; err != nil { err = fmt . Errorf ( " " , err ) return } var AESCipher cipher . Block if AESCipher , err = aes . NewCipher ( key ) ; err != nil { err = fmt . Errorf ( " " , err ) return } if len ( ciphertext ) < AESCipher . BlockSize ( ) { err = fmt . Errorf ( " " ) return } var iv [ ] byte iv = ciphertext [ : AESCipher . BlockSize ( ) ] ciphertext = ciphertext [ AESCipher . BlockSize ( ) : ] var cfbDecrypter cipher . Stream cfbDecrypter = cipher . NewCFBDecrypter ( AESCipher , iv ) message = make ( [ ] byte , len ( ciphertext ) ) cfbDecrypter . XORKeyStream ( message , ciphertext ) return }
SolvePuzzleAES solves the timelock puzzle and decrypts the ciphertext using AES
SolvePuzzleAES solves the timelock puzzle and decrypts the ciphertext using AES
// check to make sure we're going to succeed when decrypting // Split up IV into ciphertext and IV // Don't decrypt the IV // Make decrypter // make message and then decrypt