Documentation ¶
Index ¶
- func ARToWinston(a *big.Float) *big.Int
- func Base64Decode(data string) ([]byte, error)
- func Base64Encode(data []byte) string
- func BundleItemSignData(d schema.BundleItem) ([]byte, error)
- func ByteArrayToLong(b []byte) int
- func ConcatBuffer(buffers ...[]byte) []byte
- func ContainsInSlice(items []string, item string) bool
- func DecodeBlock(body string) (*schema.Block, error)
- func DecodeBundle(bundleBinary []byte) (schema.Bundle, error)
- func DecodeBundleItem(itemBinary []byte) (schema.BundleItem, error)
- func DecodeBundleItemStream(itemBinary io.Reader) (schema.BundleItem, error)
- func DecodeBundleStream(bundleData *os.File) (schema.Bundle, error)
- func DeepHash(data []interface{}) [48]byte
- func DeserializeTags(data []byte) ([]schema.Tag, error)
- func GenerateChunks(data interface{}) (schema.Chunks, error)
- func GenerateIndepHash(b schema.Block) string
- func GenerateItemBinary(d schema.BundleItem) (by []byte, err error)
- func GenerateItemBinaryStream(d schema.BundleItem) (binaryReader io.Reader, err error)
- func GenerateRsaKey(bits int) (*rsa.PrivateKey, error)
- func GetBundleItemTagsBytes(itemBinary []byte) ([]byte, error)
- func GetChunk(tx schema.Transaction, idx int, data []byte) (*schema.GetChunk, error)
- func GetChunkStream(tx schema.Transaction, idx int, data *os.File) (*schema.GetChunk, error)
- func GetSignatureData(tx *schema.Transaction) ([]byte, error)
- func Hash(data [][]byte) []byte
- func ItemSignerAddr(b schema.BundleItem) (string, error)
- func LongTo32ByteArray(long int) []byte
- func LongTo8ByteArray(long int) []byte
- func NewBundle(items ...schema.BundleItem) (schema.Bundle, error)
- func NewBundleItem(owner string, signatureType int, target, anchor string, data []byte, ...) (schema.BundleItem, error)
- func NewBundleItemStream(owner string, signatureType int, target, anchor string, data io.Reader, ...) (schema.BundleItem, error)
- func NewBundleStream(items ...schema.BundleItem) (schema.Bundle, error)
- func OwnerToAddress(owner string) (string, error)
- func OwnerToPubKey(owner string) (*rsa.PublicKey, error)
- func PaddedBigBytes(bigint *big.Int, n int) []byte
- func PrepareChunks(tx *schema.Transaction, data interface{}, dataSize int) error
- func ReadBits(bigint *big.Int, buf []byte)
- func SerializeTags(tags []schema.Tag) ([]byte, error)
- func ShortTo2ByteArray(long int) []byte
- func Sign(msg []byte, prvKey *rsa.PrivateKey) ([]byte, error)
- func SignTransaction(tx *schema.Transaction, prvKey *rsa.PrivateKey) error
- func TagsDecode(base64Tags []schema.Tag) ([]schema.Tag, error)
- func TagsEncode(tags []schema.Tag) []schema.Tag
- func Verify(msg []byte, pubKey *rsa.PublicKey, sign []byte) error
- func VerifyBundleItem(d schema.BundleItem) error
- func VerifyTransaction(tx schema.Transaction) (err error)
- func WinstonToAR(w *big.Int) *big.Float
- type ValidateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
func Base64Encode ¶
func BundleItemSignData ¶
func BundleItemSignData(d schema.BundleItem) ([]byte, error)
func ByteArrayToLong ¶
func ContainsInSlice ¶
ContainsInSlice checks if a string is in a slice of strings
func DecodeBundleItem ¶
func DecodeBundleItem(itemBinary []byte) (schema.BundleItem, error)
func DecodeBundleItemStream ¶
func DecodeBundleItemStream(itemBinary io.Reader) (schema.BundleItem, error)
func GenerateChunks ¶
*
- Generates the data_root, chunks & proofs
- needed for a transaction. *
- This also checks if the last chunk is a zero-length
- chunk and discards that chunk and proof if so.
- (we do not need to upload this zero length chunk) *
- @param data
func GenerateIndepHash ¶
func GenerateItemBinary ¶
func GenerateItemBinary(d schema.BundleItem) (by []byte, err error)
func GenerateItemBinaryStream ¶
func GenerateItemBinaryStream(d schema.BundleItem) (binaryReader io.Reader, err error)
func GenerateRsaKey ¶
func GenerateRsaKey(bits int) (*rsa.PrivateKey, error)
func GetBundleItemTagsBytes ¶
func GetChunkStream ¶
func GetSignatureData ¶
func GetSignatureData(tx *schema.Transaction) ([]byte, error)
func ItemSignerAddr ¶
func ItemSignerAddr(b schema.BundleItem) (string, error)
func LongTo32ByteArray ¶
func LongTo8ByteArray ¶
func NewBundleItem ¶
func NewBundleItemStream ¶
func NewBundleStream ¶
func NewBundleStream(items ...schema.BundleItem) (schema.Bundle, error)
func OwnerToAddress ¶
func PrepareChunks ¶
func PrepareChunks(tx *schema.Transaction, data interface{}, dataSize int) error
func ShortTo2ByteArray ¶
func SignTransaction ¶
func SignTransaction(tx *schema.Transaction, prvKey *rsa.PrivateKey) error
func VerifyBundleItem ¶
func VerifyBundleItem(d schema.BundleItem) error
func VerifyTransaction ¶
func VerifyTransaction(tx schema.Transaction) (err error)
Types ¶
type ValidateResult ¶
func ValidatePath ¶
func ValidatePath(id []byte, dest, leftBound, rightBound int, path []byte) (*ValidateResult, bool)
验证 merkle path
Click to show internal directories.
Click to hide internal directories.