init: v1.0.0

This commit is contained in:
yaole
2026-05-27 23:03:00 +08:00
commit 8d97f750eb
466 changed files with 80067 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
package pbkd
import "xdx.jelly/xgcl/mac"
type prfer interface {
prf(data []byte) ([]byte, error)
hLen() int64
}
const hmacSm3TagSize = 32
type hmacSm3 struct {
m mac.MAC
}
func newPrfHmacSm3(key []byte) prfer {
for i := len(key); i < 16; i++ {
key = append(key, 0)
}
m, _ := mac.NewHMacSm3(key, hmacSm3TagSize)
return &hmacSm3{
m: m,
}
}
func (h *hmacSm3) prf(data []byte) ([]byte, error) {
return h.m.ComputeMAC(data)
}
func (h *hmacSm3) hLen() int64 {
return hmacSm3TagSize
}