aboutsummaryrefslogtreecommitdiff
path: root/pkg/types/encoding.go
blob: 9fd2caad983d51c5454ef642b2b927da300eeef0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package types

import (
	"encoding/binary"
)

// RFC4251, section 5

func putSSHString(b []byte, str string) int {
	l := len(str)

	i := 0
	binary.BigEndian.PutUint32(b[i:i+4], uint32(l))
	i += 4
	copy(b[i:i+l], str)
	i += l

	return i
}