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 (
12
12
13
13
// XOF defines the interface to hash functions that
14
14
// support arbitrary-length output.
15
+ //
16
+ // New callers should prefer the standard library [hash.XOF].
15
17
type XOF interface {
16
18
// Write absorbs more data into the hash's state. It panics if called
17
19
// after Read.
@@ -47,6 +49,8 @@ const maxOutputLength = (1 << 32) * 64
47
49
//
48
50
// A non-nil key turns the hash into a MAC. The key must between
49
51
// zero and 32 bytes long.
52
+ //
53
+ // The result can be safely interface-upgraded to [hash.XOF].
50
54
func NewXOF (size uint32 , key []byte ) (XOF , error ) {
51
55
if len (key ) > Size {
52
56
return nil , errKeySize
@@ -93,6 +97,10 @@ func (x *xof) Clone() XOF {
93
97
return & clone
94
98
}
95
99
100
+ func (x * xof ) BlockSize () int {
101
+ return x .d .BlockSize ()
102
+ }
103
+
96
104
func (x * xof ) Reset () {
97
105
x .cfg [0 ] = byte (Size )
98
106
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