From 0d3cdedc19b9add4bd2e658a086d0bfc15cfee7b Mon Sep 17 00:00:00 2001 From: thomashaw Date: Mon, 5 Nov 2018 12:32:39 +0000 Subject: [PATCH] encoders/hash/siphash --- Gemfile | 1 + Gemfile.lock | 4 ++++ .../hash/siphash/manifests/.no_puppet | 0 .../hash/siphash/secgen_local/local.rb | 15 +++++++++++++ .../encoders/hash/siphash/secgen_metadata.xml | 22 +++++++++++++++++++ modules/encoders/hash/siphash/siphash.pp | 0 6 files changed, 42 insertions(+) create mode 100644 modules/encoders/hash/siphash/manifests/.no_puppet create mode 100644 modules/encoders/hash/siphash/secgen_local/local.rb create mode 100644 modules/encoders/hash/siphash/secgen_metadata.xml create mode 100644 modules/encoders/hash/siphash/siphash.pp diff --git a/Gemfile b/Gemfile index f3567d961..bf103c0a6 100644 --- a/Gemfile +++ b/Gemfile @@ -25,6 +25,7 @@ gem 'duplicate' gem 'smbhash' gem 'digest-sha3' gem 'digest-whirlpool' +gem 'digest-siphash' #development only gems go here group :test, :development do diff --git a/Gemfile.lock b/Gemfile.lock index 28615fa47..880a651bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,6 +14,9 @@ GEM credy (0.2.1) thor (~> 0.19.1) digest-sha3 (1.1.0) + digest-simple (1.1.0) + digest-siphash (1.0.1) + digest-simple digest-whirlpool (1.0.3) duplicate (1.1.1) facter (2.5.1) @@ -107,6 +110,7 @@ DEPENDENCIES cinch credy digest-sha3 + digest-siphash digest-whirlpool duplicate faker diff --git a/modules/encoders/hash/siphash/manifests/.no_puppet b/modules/encoders/hash/siphash/manifests/.no_puppet new file mode 100644 index 000000000..e69de29bb diff --git a/modules/encoders/hash/siphash/secgen_local/local.rb b/modules/encoders/hash/siphash/secgen_local/local.rb new file mode 100644 index 000000000..c0e26692f --- /dev/null +++ b/modules/encoders/hash/siphash/secgen_local/local.rb @@ -0,0 +1,15 @@ +#!/usr/bin/ruby +require_relative '../../../../../lib/objects/local_hash_encoder.rb' + +class SipHashEncoder < HashEncoder + def initialize + super + self.module_name = 'SipHash Encoder' + end + + def hash_function(string) + Digest::SipHash.hexdigest(string) + end +end + +SipHashEncoder.new.run \ No newline at end of file diff --git a/modules/encoders/hash/siphash/secgen_metadata.xml b/modules/encoders/hash/siphash/secgen_metadata.xml new file mode 100644 index 000000000..c48bcc3f9 --- /dev/null +++ b/modules/encoders/hash/siphash/secgen_metadata.xml @@ -0,0 +1,22 @@ + + + + SipHash Encoder + Thomas Shaw + MIT + Generates a SipHash digest for each of the strings. + + hash + siphash + linux + windows + + strings_to_encode + salt + return_salts + + string + + \ No newline at end of file diff --git a/modules/encoders/hash/siphash/siphash.pp b/modules/encoders/hash/siphash/siphash.pp new file mode 100644 index 000000000..e69de29bb