2015-08-19 19:06:58 +00:00
|
|
|
/* Copyright 2015, Michele Santullo
|
|
|
|
* This file is part of DoorKeeper.
|
|
|
|
*
|
|
|
|
* DoorKeeper is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* DoorKeeper is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with DoorKeeper. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-06-21 00:42:52 +00:00
|
|
|
#ifndef id1E6CCE44307549A9B6C9E4E5923AC002
|
|
|
|
#define id1E6CCE44307549A9B6C9E4E5923AC002
|
|
|
|
|
2015-06-24 20:13:48 +00:00
|
|
|
//#include "doorkeeper/helpers/hashing.hpp"
|
2015-06-21 00:42:52 +00:00
|
|
|
#include "doorkeeper/implem/compatibility.h"
|
|
|
|
#include <cstdint>
|
|
|
|
#include <ciso646>
|
|
|
|
#include <climits>
|
|
|
|
|
|
|
|
namespace dk {
|
|
|
|
struct HashType {
|
|
|
|
constexpr HashType ( uint64_t parA, uint64_t parB, uint64_t parC ) :
|
|
|
|
a(parA), b(parB), c(parC)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
constexpr HashType ( uint64_t parAP, uint64_t parA, uint64_t parBP, uint64_t parB, uint64_t parCP, uint64_t parC ) :
|
|
|
|
a(0 == parAP ? parA : (0 == parBP ? parB : (0 == parCP ? parC : throw 0))),
|
|
|
|
b(1 == parAP ? parA : (1 == parBP ? parB : (1 == parCP ? parC : throw 0))),
|
|
|
|
c(2 == parAP ? parA : (2 == parBP ? parB : (2 == parCP ? parC : throw 0)))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
constexpr HashType ( const HashType& ) = default;
|
|
|
|
constexpr uint64_t operator[] ( uint64_t parIndex ) const {
|
|
|
|
return (parIndex == 0 ? a :
|
|
|
|
(parIndex == 1 ? b :
|
|
|
|
(parIndex == 2 ? c : throw 0)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t a;
|
|
|
|
uint64_t b;
|
|
|
|
uint64_t c;
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr HashType tiger ( const char* parStr, uint64_t parLen, char parPad ) a_pure;
|
|
|
|
} //namespace dk
|
|
|
|
|
|
|
|
#include "doorkeeper/implem/tiger_bt.inl"
|
|
|
|
|
|
|
|
#endif
|