mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
Expand HMAC support in Salt; require an identifier be passed in to specify type but allow generation with and without. Add a StaticSalt ID for testing functions. Fix bugs; unit tests pass.
This commit is contained in:
@@ -16,7 +16,7 @@ import (
|
||||
//
|
||||
// The structure is modified in-place.
|
||||
func Hash(salter *salt.Salt, raw interface{}) error {
|
||||
fn := salter.GetHMAC
|
||||
fn := salter.GetIdentifiedHMAC
|
||||
|
||||
switch s := raw.(type) {
|
||||
case *logical.Auth:
|
||||
@@ -86,17 +86,6 @@ func HashStructure(s interface{}, cb HashCallback) (interface{}, error) {
|
||||
// a value.
|
||||
type HashCallback func(string) string
|
||||
|
||||
// HashSHA1 returns a HashCallback that hashes data with SHA1 and
|
||||
// with an optional salt. If salt is a blank string, no salt is used.
|
||||
/*
|
||||
func HashSHA1(salt string) HashCallback {
|
||||
return func(v string) (string, error) {
|
||||
hashed := sha1.Sum([]byte(v + salt))
|
||||
return "sha1:" + hex.EncodeToString(hashed[:]), nil
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// hashWalker implements interfaces for the reflectwalk package
|
||||
// (github.com/mitchellh/reflectwalk) that can be used to automatically
|
||||
// replace primitives with a hashed value.
|
||||
|
||||
Reference in New Issue
Block a user