AMFNV1a  201909
String localization library
Andromeda Exception library

AMFNV1a - constexpr implementation of FNV1a hash algorithmThere are two variants, 32 and 64 bit. If parameter string is an constexpr expression, result is also constexpr expression.

Usage

Let's have this table. First word is an original string, second is a "translated" string.

#include <iostream>
using namespace AMCore;
using namespace std;
int main() {
cout<<"Enter password (color of blood): ";
char pass[1024];
cin>>pass;
uint64_t hash = AMFNV1aAlgorithm::fnv1a64(pass);
switch (hash)
{
case AMCEFNV1aAlgorithm::fnv1a64("blue"): cout<<"Fail"<<endl;break;
case AMCEFNV1aAlgorithm::fnv1a64("green"): cout<<"Fail"<<endl;break;
case AMCEFNV1aAlgorithm::fnv1a64("red"): cout<<"Hooray!"<<endl;break;
case AMCEFNV1aAlgorithm::fnv1a64("yellow"): cout<<"Fail"<<endl;break;
default: cout<<"Fail"<<endl;
}
return 0;
}

Sources

Download at GitHUB

Building AMFNV1a

Getting sources

git submodule update

Compiling

mkdir cmake-build-debug
cd cmake-build-debug
cmake ..
make

Single test (not necessary)

./TEST_AMExeption

Licencing

This library is under GNU GPL v3 license. If you need business license, don't hesitate to contact me.

Contribute

Please contact me.

Dependencies

AMCore::AMCEFNV1aAlgorithm::fnv1a64
static constexpr std::uint64_t fnv1a64(const char *input)
64bit variant of FNV1a Algorithm
Definition: AMCEFNV1a.h:62
AMCEFNV1a.h