unleashed-firmware/applications/plugins/totp/services/hmac/byteswap.c
MX 8520daf28b
addding some great plugins to be preinstalled
and running fbt format, and fixing TOTP printf format
2022-10-12 05:01:37 +03:00

12 lines
417 B
C

#include "byteswap.h"
uint32_t swap_uint32(uint32_t val) {
val = ((val << 8) & 0xFF00FF00) | ((val >> 8) & 0xFF00FF);
return (val << 16) | (val >> 16);
}
uint64_t swap_uint64(uint64_t val) {
val = ((val << 8) & 0xFF00FF00FF00FF00ULL) | ((val >> 8) & 0x00FF00FF00FF00FFULL);
val = ((val << 16) & 0xFFFF0000FFFF0000ULL) | ((val >> 16) & 0x0000FFFF0000FFFFULL);
return (val << 32) | (val >> 32);
}