mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-02 17:38:27 +02:00
wip
This commit is contained in:
parent
dad954ae16
commit
5b717c9aa5
15 changed files with 746 additions and 9 deletions
16
pkg/cryptutil/pseudonymize.go
Normal file
16
pkg/cryptutil/pseudonymize.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
package cryptutil
|
||||
|
||||
import (
|
||||
"crypto/hmac"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"io"
|
||||
)
|
||||
|
||||
// Pseudonymize pseudonymizes data by computing the HMAC-SHA256 of the data.
|
||||
func Pseudonymize(organizationID string, data string) string {
|
||||
h := hmac.New(sha256.New, []byte(organizationID))
|
||||
_, _ = io.WriteString(h, data)
|
||||
bs := h.Sum(nil)
|
||||
return base64.StdEncoding.EncodeToString(bs)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue