Пример #1
0
func NewBlock(data []byte) (*Block, error) {
	if len(data) > BYTES_PER_BLOCK {
		return nil, fmt.Errorf("block with size %v exceeds max %v",
			len(data), BYTES_PER_BLOCK)
	}
	id := util.Sha256AsString(data)
	return &Block{ID: BlockID(id), Data: data}, nil
}
Пример #2
0
func ocIDToContainerID(id msg.OcID) ContainerID {
	return ContainerID(util.Sha256AsString([]byte(id.String())))
}