X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/6949aca9fa0e37539fc277bac78e3d7a22117467..15c4dc5ace24e6081d1597b011148f156cdd599e:/armsrc/util.c?ds=inline diff --git a/armsrc/util.c b/armsrc/util.c index 3cad25f4..e6332a7b 100644 --- a/armsrc/util.c +++ b/armsrc/util.c @@ -64,6 +64,24 @@ char* strncat(char *dest, const char *src, unsigned int n) return dest; } +void num_to_bytes(uint64_t n, size_t len, byte_t* dest) +{ + while (len--) { + dest[len] = (byte_t) n; + n >>= 8; + } +} + +uint64_t bytes_to_num(byte_t* src, size_t len) +{ + uint64_t num = 0; + while (len--) + { + num = (num << 8) | (*src); + src++; + } + return num; +} void LEDsoff() {