mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-01 11:26:29 +02:00
* wip * add response * handle empty email * use set, update log * add test * add coalesce, comments, test * add test, fix bug * use builtin cmp.Or * remove wait ready call * use api error
16 lines
377 B
Go
16 lines
377 B
Go
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)
|
|
}
|