本文整理匯總了Golang中github.com/OpenWhiteBox/AES/constructions/saes.Construction.SubByte方法的典型用法代碼示例。如果您正苦於以下問題:Golang Construction.SubByte方法的具體用法?Golang Construction.SubByte怎麽用?Golang Construction.SubByte使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/OpenWhiteBox/AES/constructions/saes.Construction
的用法示例。
在下文中一共展示了Construction.SubByte方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: backOneRound
// backOneRound takes round key i and returns round key i-1.
func backOneRound(roundKey [16]byte, round int) (out [16]byte) {
constr := saes.Construction{}
// Recover everything except the first word by XORing consecutive blocks.
for pos := 4; pos < 16; pos++ {
out[pos] = roundKey[pos] ^ roundKey[pos-4]
}
// Recover the first word by XORing the first block of the roundKey with f(last block of roundKey), where f is a
// subroutine of AES' key scheduling algorithm.
for pos := 0; pos < 4; pos++ {
out[pos] = roundKey[pos] ^ constr.SubByte(out[12+(pos+1)%4])
}
out[0] ^= powx[round-1]
return
}
示例2: Encode
func (sbox sbox) Encode(in byte) byte {
constr := saes.Construction{}
return constr.SubByte(in)
}