esphome/mlock-common.h

10 lines
289 B
C
Raw Permalink Normal View History

2024-07-20 02:25:03 +00:00
#include <algorithm>
#include <string>
int decode_token(std::string token) {
// strip dashes from token
token.erase(std::remove(token.begin(), token.end(), '-'), token.end());
// parse token from hex to unsigned int
return static_cast<unsigned int>(std::stoll(token, nullptr, 16));
}