<commit_before>package libkbfs

import (
	"bytes"
	"crypto/rand"
	"encoding/hex"
	"fmt"
	"sort"
	"strings"

	libkb "github.com/keybase/client/go/libkb"
)

const (
	DIRID_LEN       = 16
	DIRID_SUFFIX    = 0x16
	PUBDIRID_SUFFIX = 0x17
)

type DirId [DIRID_LEN]byte

func (d DirId) String() string {
	return hex.EncodeToString(d[:])
}

func GetPublicUid() libkb.UID {
	out := libkb.UID{0}
	out[libkb.UID_LEN-1] = PUBDIRID_SUFFIX
	return out
}

func (d DirId) IsPublic() bool {
	return d[DIRID_LEN-1] == PUBDIRID_SUFFIX
}

var ReaderSep string = "#"
var PublicUid libkb.UID = GetPublicUid()
var PublicName string = "public"

// TODO: how to identify devices
type DeviceId int
type HMAC []byte

// TODO: Use libkb.GenericKey instead
type Key struct {
	Key     []byte
	Version uint32
	Type    uint32
}

var NullKey Key = Key{}

func NewKeyVersioned(v uint32, t uint32) Key {
	return Key{make([]byte, 1, 1), v, t}
}

func NewKey() Key {
	return NewKeyVersioned(0, 0)
}

// type of hash key for each data block
type BlockId libkb.NodeHashShort

func RandBlockId() BlockId {
	var id BlockId
	// TODO: deal with errors?
	rand.Read(id[:])
	return id
}

type BlockPointer struct {
	Id     BlockId
	KeyId  int // which version of the DirKeys to use
	Ver    int // which version of the KBFS data structures is pointed to
	Writer libkb.UID
	Size   uint32
}

func (p BlockPointer) GetKeyId() int {
	return p.KeyId<commit_msg>Add comment for Size<commit_after>package libkbfs

import (
	"bytes"
	"crypto/rand"
	"encoding/hex"
	"fmt"
	"sort"
	"strings"

	libkb "github.com/keybase/client/go/libkb"
)

const (
	DIRID_LEN       = 16
	DIRID_SUFFIX    = 0x16
	PUBDIRID_SUFFIX = 0x17
)

type DirId [DIRID_LEN]byte

func (d DirId) String() string {
	return hex.EncodeToString(d[:])
}

func GetPublicUid() libkb.UID {
	out := libkb.UID{0}
	out[libkb.UID_LEN-1] = PUBDIRID_SUFFIX
	return out
}

func (d DirId) IsPublic() bool {
	return d[DIRID_LEN-1] == PUBDIRID_SUFFIX
}

var ReaderSep string = "#"
var PublicUid libkb.UID = GetPublicUid()
var PublicName string = "public"

// TODO: how to identify devices
type DeviceId int
type HMAC []byte

// TODO: Use libkb.GenericKey instead
type Key struct {
	Key     []byte
	Version uint32
	Type    uint32
}

var NullKey Key = Key{}

func NewKeyVersioned(v uint32, t uint32) Key {
	return Key{make([]byte, 1, 1), v, t}
}

func NewKey() Key {
	return NewKeyVersioned(0, 0)
}

// type of hash key for each data block
type BlockId libkb.NodeHashShort

func RandBlockId() BlockId {
	var id BlockId
	// TODO: deal with errors?
	rand.Read(id[:])
	return id
}

type BlockPointer struct {
	Id     BlockId
	KeyId  int // which version of the DirKeys to use
	Ver    int // which version of the KBFS data structures is pointed to
	Writer libkb.UID
	Size   uint32 // the size of the data contained in the block
}

func (p BlockPointer) GetKeyId() int {
	return p.KeyId
{'fraction_non_alphanumeric': 0.10515320334261838, 'fraction_numerical': 0.017409470752089137, 'mean_word_length': 3.6041666666666665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1739448', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1089, 'n_words': 337}