コード例 #1
0
ファイル: des_test.go プロジェクト: a2800276/des.go
func testDecBulk(t *testing.T, kIdx int, cipher block.Cipher, cipherTexts [][][]byte) {
	result := make([]byte, 8)
	for j, plain := range plainTextBlocks {
		cipher.Decrypt(result, cipherTexts[j][kIdx])
		if 1 != subtle.ConstantTimeCompare(result, plain) {
			t.Errorf("? DES #%d decrypt failed with plaintext #%d", j, kIdx)
		}
	}
}
コード例 #2
0
ファイル: bench.go プロジェクト: a2800276/des.go
func gen_iv(c block.Cipher) []byte {
	return make([]byte, c.BlockSize())
}