#include <pfodMAC.h>
|
static void | resetPowerCycles (int eepromAddress=0) |
| Use this call to reset the power cycles to 0xffff Then remove the call from the code for normal operation. More...
|
|
static void | eeprom_write (int address, uint8_t value) |
|
Definition at line 23 of file pfodMAC.h.
◆ pfodMAC()
◆ buildChallenge()
boolean pfodMAC::buildChallenge |
( |
byte * |
challengeBytes, |
|
|
uint32_t |
mS_sinceLastConnection |
|
) |
| |
buildChallenge – NOTE: each call to this method increments the connection counter!!! Challenge built from powerCycles + connectionCounter + mS_sinceLastConnection (limited to 31 bits) 32th bit set if last connection failed finally hashes the challange bytes (result stored in hash fn) use getHashedResult() to retrieve pointer to result when needed for checking return value
All counters stored in BigEndian format into the challenge byte array powerCycles read on start up
- Parameters
-
challengeBytes | byte* to array to store challenge |
mS_sinceLastConnection | mS since last connection (max value about 25days), -ve if last connection failed |
returns true if isValid() is true;
◆ checkMsgHash()
boolean pfodMAC::checkMsgHash |
( |
const byte * |
msgHash, |
|
|
uint16_t |
len |
|
) |
| |
Converts msgHash from hex Digits to bytes and then compares the resulting byte[] with the current hash result.
- Parameters
-
msgHash | null terminated ascii string of hex chars (0..9A..F) or (0..9a..f) this input is overwritten with the converted bytes |
hashSize | the number of bytes expected in the hash must be < length of msgHash since the converted bytes are store in that array. |
◆ eeprom_read()
uint8_t pfodMAC::eeprom_read |
( |
int |
address | ) |
|
◆ eeprom_write()
static void pfodMAC::eeprom_write |
( |
int |
address, |
|
|
uint8_t |
value |
|
) |
| |
|
static |
◆ finishHash()
void pfodMAC::finishHash |
( |
| ) |
|
◆ getHashedResult()
byte* pfodMAC::getHashedResult |
( |
| ) |
|
◆ init()
boolean pfodMAC::init |
( |
int |
eepromAddress | ) |
|
◆ initHash()
void pfodMAC::initHash |
( |
| ) |
|
◆ isBigEndian()
boolean pfodMAC::isBigEndian |
( |
| ) |
|
◆ isValid()
boolean pfodMAC::isValid |
( |
| ) |
|
◆ noEEPROM()
void pfodMAC::noEEPROM |
( |
| ) |
|
◆ printBytesInHex()
void pfodMAC::printBytesInHex |
( |
Print * |
out, |
|
|
const byte * |
b, |
|
|
size_t |
len |
|
) |
| |
◆ putBytesToHash()
void pfodMAC::putBytesToHash |
( |
byte * |
b, |
|
|
int |
len |
|
) |
| |
◆ putByteToHash()
void pfodMAC::putByteToHash |
( |
byte |
b | ) |
|
◆ putLongToHash()
void pfodMAC::putLongToHash |
( |
uint32_t |
l | ) |
|
◆ readSecretKey()
unsigned int pfodMAC::readSecretKey |
( |
byte * |
bRtn, |
|
|
int |
keyAdd |
|
) |
| |
◆ resetPowerCycles()
static void pfodMAC::resetPowerCycles |
( |
int |
eepromAddress = 0 | ) |
|
|
static |
Use this call to reset the power cycles to 0xffff Then remove the call from the code for normal operation.
- Parameters
-
eepromAddress | the base address on the eepromStorage, defaults to 0 |
◆ reverseBytes()
void pfodMAC::reverseBytes |
( |
byte * |
b, |
|
|
int |
len |
|
) |
| |
◆ setDebugStream()
void pfodMAC::setDebugStream |
( |
Print * |
out | ) |
|
◆ setSecretKey()
void pfodMAC::setSecretKey |
( |
byte * |
key, |
|
|
int |
len |
|
) |
| |
◆ challengeByteSize
const uint8_t pfodMAC::challengeByteSize = 8 |
|
static |
◆ challengeHashByteSize
const uint8_t pfodMAC::challengeHashByteSize = 8 |
|
static |
◆ KeyOffset
const uint8_t pfodMAC::KeyOffset |
|
static |
◆ maxKeySize
const uint8_t pfodMAC::maxKeySize = 16 |
|
static |
◆ msgHashByteSize
const uint8_t pfodMAC::msgHashByteSize = 4 |
|
static |
◆ PowerCyclesOffset
const uint8_t pfodMAC::PowerCyclesOffset |
|
static |