File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ import (
1212
1313// XOF defines the interface to hash functions that
1414// support arbitrary-length output.
15+ //
16+ // New callers should prefer the standard library [hash.XOF].
1517type XOF interface {
1618 // Write absorbs more data into the hash's state. It panics if called
1719 // after Read.
@@ -47,6 +49,8 @@ const maxOutputLength = (1 << 32) * 64
4749//
4850// A non-nil key turns the hash into a MAC. The key must between
4951// zero and 32 bytes long.
52+ //
53+ // The result can be safely interface-upgraded to [hash.XOF].
5054func NewXOF (size uint32 , key []byte ) (XOF , error ) {
5155 if len (key ) > Size {
5256 return nil , errKeySize
@@ -93,6 +97,10 @@ func (x *xof) Clone() XOF {
9397 return & clone
9498}
9599
100+ func (x * xof ) BlockSize () int {
101+ return x .d .BlockSize ()
102+ }
103+
96104func (x * xof ) Reset () {
97105 x .cfg [0 ] = byte (Size )
98106 binary .LittleEndian .PutUint32 (x .cfg [4 :], uint32 (Size )) // leaf length
Original file line number Diff line number Diff line change 1+ // Copyright 2025 The Go Authors. All rights reserved.
2+ // Use of this source code is governed by a BSD-style
3+ // license that can be found in the LICENSE file.
4+
5+ //go:build go1.25
6+
7+ package blake2b
8+
9+ import "hash"
10+
11+ var _ hash.XOF = (* xof )(nil )
You can’t perform that action at this time.
0 commit comments