Added an assertion which will trigger when number size wrong
This commit is contained in:
@ -25,6 +25,7 @@
|
|||||||
#include <dynstring.h>
|
#include <dynstring.h>
|
||||||
#include <mxml.h>
|
#include <mxml.h>
|
||||||
|
|
||||||
|
|
||||||
extern char *trim(char *);
|
extern char *trim(char *);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -141,6 +142,8 @@ static long long calculateToken(char *password, long long hash)
|
|||||||
long long tmp;
|
long long tmp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
assert(sizeof(hash) == 8);
|
||||||
|
|
||||||
tmp = hash ^ 0x80AA80AA;
|
tmp = hash ^ 0x80AA80AA;
|
||||||
for(i = 0; i < strlen(password); i++){
|
for(i = 0; i < strlen(password); i++){
|
||||||
tmp += password[i] * (long long)pow(2,i);
|
tmp += password[i] * (long long)pow(2,i);
|
||||||
|
Reference in New Issue
Block a user