// F5Star is the anonymity key derivation function for the re-synchronisation message.
// F5Star takes key K and random challenge RAND, and returns resynch anonymity key AK.
F5Star is the anonymity key derivation function for the re-synchronisation message.
F5Star takes key K and random challenge RAND, and returns resynch anonymity key AK.
// F5Star is the anonymity key derivation function for the re - synchronisation message . // F5Star takes key K and random challenge RAND and returns resynch anonymity key AK .
func (m *Milenage) F5Star() (aks []byte, err error) {
	if err := m.validateLength(); err != nil {
		return nil, err
	}
	if m.OPc == nil {
		if err := m.computeOPc(); err != nil {
			return nil, err
		}
	}
	rijndaelInput := make([]byte, 16)
	for i := 0; i < 16; i++ {
		rijndaelInput[i] = m.RAND[i] ^ m.OPc[i]
	}
	tmp, err := encrypt(m.K, rijndaelInput)
	if err != nil {
		return
	}
	for i := 0; i < 16; i++ {
		rijndaelInput[(i+4)%16] = tmp[i] ^ m.OPc[i]
	}
	rijndaelInput[15] ^= 8
	out, err := encrypt(m.K, rijndaelInput)
	if err != nil {
		return
	}
	aks = xor(out, m.OPc)[:6]
	m.AKS = aks
	return aks, nil
}
func ( m * Milenage ) F5Star ( ) ( aks [ ] byte , err error ) { if err := m . validateLength ( ) ; err != nil { return nil , err } if m . OPc == nil { if err := m . computeOPc ( ) ; err != nil { return nil , err } } rijndaelInput := make ( [ ] byte , 16 ) for i := 0 ; i < 16 ; i ++ { rijndaelInput [ i ] = m . RAND [ i ] ^ m . OPc [ i ] } tmp , err := encrypt ( m . K , rijndaelInput ) if err != nil { return } for i := 0 ; i < 16 ; i ++ { rijndaelInput [ ( i + 4 ) % 16 ] = tmp [ i ] ^ m . OPc [ i ] } rijndaelInput [ 15 ] ^= 8 out , err := encrypt ( m . K , rijndaelInput ) if err != nil { return } aks = xor ( out , m . OPc ) [ : 6 ] m . AKS = aks return aks , nil }
F5Star is the anonymity key derivation function for the re-synchronisation message.
F5Star is the anonymity key derivation function for the re - synchronisation message .
// To obtain output block OUT5: XOR OPc and TEMP, rotate by r5=96, and XOR on the // constant c5 (which is all zeroes except that the 3rd from last bit is 1).