1
0
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:
v2ray
2016-07-17 23:11:05 +02:00
parent 1931820c4c
commit 85d6e1ad13
3 changed files with 9 additions and 6 deletions

View File

@@ -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