GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - LimiNode/siphash-cpp: SipHash Headers Only C ++ Library

BranchesTags
Open more actions menu

Latest commit

 

History

32 Commits
32 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
cmake
cmake
 
 
examples
examples
 
 
include/siphash_cpp
include/siphash_cpp
 
 
scripts
scripts
 
 
tests
tests
 
 
AGENTS.md
AGENTS.md
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
TODO.md
TODO.md
 
 
vcpkg.json
vcpkg.json
 
 

Repository files navigation

siphash_cpp

Linux Win

SipHash header only C ++ library.

SipHash is a family of keyed hash functions optimized for short messages. It is widely used to protect hash tables from collision attacks and to authenticate lightweight data.

Advantages

  • Secret key makes hash-flooding attacks impractical
  • Small, simple code that runs quickly on short inputs

Limitations

  • Slower than non-cryptographic hashes such as MurmurHash
  • 64-bit output is not meant for high-security message authentication or large files

The key must contain at least 16 bytes.

Example:

#include "siphash.hpp"

\\...

std::array<char, 16> key = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
std::string data("hello");

std::cout << "SipHash-2-4 for 'hello': " << siphash_cpp::siphash_2_4(data, key) << std::endl;
std::cout << "SipHash-4-8 for 'hello': " << siphash_cpp::siphash_4_8(data, key) << std::endl;
std::cout << "SipHash-4-8 for 'hello': " << siphash_cpp::siphash(data, key, 4, 8) << std::endl;

siphash_cpp::SipHash siphash;
siphash.init(key, 2, 4);
std::cout << "SipHash-2-4 for 'hello': " << siphash.update(data).digest() << std::endl;

Installation

vcpkg

This library can be installed with vcpkg:

vcpkg install siphash-cpp

After installation, a CMake project may use:

find_package(siphash_cpp CONFIG REQUIRED)
target_link_libraries(your_app PRIVATE siphash_cpp::siphash_cpp)

To verify the build with vcpkg, run:

VCPKG_ROOT=/path/to/vcpkg ./scripts/run_tests.sh

Git submodule

git submodule add https://github.com/NewYaroslav/siphash-cpp.git external/siphash-cpp

Then add the subdirectory and link the target in your CMakeLists.txt:

add_subdirectory(external/siphash-cpp)
target_link_libraries(your_app PRIVATE siphash_cpp::siphash_cpp)

Related Projects

  • hmac-cpp
  • aes-cpp

About

SipHash Headers Only C ++ Library

Topics

c-plus-pluscpp11cpp17cryptographic-hash-functionscryptographyhashlibrarypseudorandom-functionssiphash

Resources

Readme
CC0-1.0 license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.