All Projects → github → tainted_hash

github / tainted_hash

Licence: MIT license
No description or website provided.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to tainted hash

MM.Hash
Profit Switching Miner For HiveOS/Linux- OLD VERSION: Project Moved To SWARM! https://github.com/MaynardMiner/SWARM
Stars: ✭ 17 (-67.31%)
Mutual labels:  hash
blurhash
Blurhash encoder/decoder algorithm implemenation in Nim.
Stars: ✭ 26 (-50%)
Mutual labels:  hash
php-argon2-ext
PHP7 extension for Argon2
Stars: ✭ 34 (-34.62%)
Mutual labels:  hash
Poseidon252
Reference implementation for the Poseidon Snark-friendly Hash algorithm.
Stars: ✭ 95 (+82.69%)
Mutual labels:  hash
SHA256
A C++ SHA256 implementation.
Stars: ✭ 79 (+51.92%)
Mutual labels:  hash
MD5-Hash-Changer
C# Application to Change MD5 Hash of any file
Stars: ✭ 111 (+113.46%)
Mutual labels:  hash
space-router
Framework agnostic router for single page apps
Stars: ✭ 36 (-30.77%)
Mutual labels:  hash
phc-crypto
Hashing algorithms simplified (supports Argon2, Bcrypt, Scrypt, and PBKDF2)
Stars: ✭ 22 (-57.69%)
Mutual labels:  hash
node-blake2
All four BLAKE2 variants (blake2b, blake2bp, blake2s, blake2sp) with stream support for Node.js
Stars: ✭ 52 (+0%)
Mutual labels:  hash
XXHash
XXHash - Extremely fast hash algorithm,impl for csharp,can process 11.8 GB/s on modern cpu. impl with net core 2.0 and .net
Stars: ✭ 24 (-53.85%)
Mutual labels:  hash
fhash
fHash - an open source files hash calculator for Windows and macOS
Stars: ✭ 222 (+326.92%)
Mutual labels:  hash
java-gm
Java语言国密基础库
Stars: ✭ 33 (-36.54%)
Mutual labels:  hash
prvhash
PRVHASH - Pseudo-Random-Value Hash. Hash functions, PRNG with unlimited period, randomness extractor. (Codename Gradilac/Градилак)
Stars: ✭ 194 (+273.08%)
Mutual labels:  hash
hashids.pm
Hashids, ported for Perl
Stars: ✭ 15 (-71.15%)
Mutual labels:  hash
WebCrypto.swift
A small collection of cryptographic functions based on the JavaScript WebCrypto API.
Stars: ✭ 16 (-69.23%)
Mutual labels:  hash
py-cryptonight
Python Cryptonight binding / extension. Monero hash function, proof-of-work, cn_slow_hash()
Stars: ✭ 20 (-61.54%)
Mutual labels:  hash
SSISMHash
SSIS Multiple Hash makes it possible to generate many Hash values from each input row. Hash's supported include MD5 and SHA1.
Stars: ✭ 32 (-38.46%)
Mutual labels:  hash
hash-checker
Fast and simple application that allows you to generate and compare hashes from files and text
Stars: ✭ 72 (+38.46%)
Mutual labels:  hash
noble-hashes
Audited & minimal JS implementation of SHA2, SHA3, RIPEMD, BLAKE2/3, HMAC, HKDF, PBKDF2 & Scrypt
Stars: ✭ 213 (+309.62%)
Mutual labels:  hash
vscode-redis
Redis Client in VSCode!
Stars: ✭ 63 (+21.15%)
Mutual labels:  hash

Tainted Hash

A TaintedHash is a wrapper around a normal Hash that only exposes the keys that have been approved. This is useful in cases where a Hash is built from user input from an external service (such as Rails or Sinatra). By forcing the developer to approve keys, no unexpected keys are passed to data stores. Because of this specific use case, it is assumed all keys are strings.

By default, no keys have been approved.

hash = {'a' => 1, 'b' => 2, 'c' => 3}
tainted = TaintedHash.new hash

You can access keys manually to get the value and approve them:

Use #expose to expose keys.

tainted.include?(:a) # false
tainted['a'] # Returns 1
tainted[:a]  # Symbols are OK too.
tainted.include?(:a) # false, not exposed
tainted.expose :a
tainted.include?(:a) # true
tainted.keys # ['a']

If using Rails 2.3, require tainted_hash/rails to setup the necessary hooks. It amounts to little more than this:

def wrap_params_with_tainted_hash
  @_params = TaintedHash.new(@_params.to_hash)
end

Set this up as a before_filter early in the stack. However, it should run after filters like #filter_parameter_logging that needs to filter any key.

Note on Patches/Pull Requests

  1. Fork the project on GitHub.
  2. Make your feature addition or bug fix.
  3. Add tests for it. This is important so I don't break it in a future version unintentionally.
  4. Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  5. Send me a pull request. Bonus points for topic branches.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].