mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-09-29 21:54:10 -04:00
prepend hash
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
package alloc
|
||||
|
||||
import (
|
||||
"hash"
|
||||
"io"
|
||||
|
||||
"github.com/v2ray/v2ray-core/common/serial"
|
||||
@@ -109,6 +110,12 @@ func (b *Buffer) PrependUint32(v uint32) *Buffer {
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *Buffer) PrependHash(h hash.Hash) *Buffer {
|
||||
b.SliceBack(h.Size())
|
||||
h.Sum(b.Value[:0])
|
||||
return b
|
||||
}
|
||||
|
||||
// Bytes returns the content bytes of this Buffer.
|
||||
func (b *Buffer) Bytes() []byte {
|
||||
return b.Value
|
||||
|
Reference in New Issue
Block a user