checkbrute_gtajoaat/src/plugin_gtajoaat.c

52 lines
1.4 KiB
C

/*****************************************************************************
* checkbrute_gtajoaat Checkbrute GTAJOAAT plugin
* Copyright (C) 2020 Syping
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* This software is provided as-is, no warranties are given to you, we are not
* responsible for anything with use of the software, you are self responsible.
*****************************************************************************/
#include <stdint.h>
#include <stdio.h>
#include <ctype.h>
const char* checkbrute_format()
{
return "GTAJOAAT";
}
const char* checkbrute_version()
{
return "0.1";
}
uint32_t checkbrute_hash32(unsigned char* data, size_t size)
{
size_t i = 0;
uint32_t hash = 0;
while (i != size) {
hash += tolower(data[i++]);
hash += hash << 10;
hash ^= hash >> 6;
}
hash += hash << 3;
hash ^= hash >> 11;
hash += hash << 15;
return hash & 0xffffffffL;
}
int checkbrute_hashsz()
{
return 4;
}