detect.c (432B)
1 #include <stddef.h> 2 3 #include "common.h" 4 5 #ifdef __cplusplus 6 extern "C" { 7 #endif 8 9 char fmt_0x00_detect(unsigned char *cipherdata, size_t len) { 10 // Only claim 0x00-prefixed payloads of a known size, so a future format 11 // sharing the leading null-byte but with a different length won't collide 12 if (len != 33 && len != 97) return 0; 13 if ((*cipherdata) == '\0') return 1; 14 return 0; 15 } 16 17 #ifdef __cplusplus 18 } // extern "C" 19 #endif