YubikeyOTP.CRC (YubikeyOTP v0.2.1) View Source
Checksums relevant to YubiKeys
Link to this section Summary
Functions
Computes the CRC16 (ISO 13239) checksum used in the YubiOTP.
Checks whether the given buffer has the correct CRC16 residual.
Link to this section Functions
Computes the CRC16 (ISO 13239) checksum used in the YubiOTP.
Examples
iex> YubikeyOTP.CRC.crc16("")
65535
iex> YubikeyOTP.CRC.crc16(<<0xffff :: 16>>)
0
iex> YubikeyOTP.CRC.crc16("1234567890")
46316
Specs
Checks whether the given buffer has the correct CRC16 residual.
Examples
iex> YubikeyOTP.CRC.verify_crc16("") false
iex> YubikeyOTP.CRC.verify_crc16("1234567890" <> <<0x13, 0x4b>>) true