本文整理汇总了Golang中hash/crc64.MakeTable函数的典型用法代码示例。如果您正苦于以下问题:Golang MakeTable函数的具体用法?Golang MakeTable怎么用?Golang MakeTable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了MakeTable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: GetHash

func GetHash(a string) (hash.Hash, error) {
    var h hash.Hash
    switch a {
    case "adler32":
        h = adler32.New()
    case "crc32", "crc32ieee":
        h = crc32.New(crc32.MakeTable(crc32.IEEE))
    case "crc32castagnoli":
        h = crc32.New(crc32.MakeTable(crc32.Castagnoli))
    case "crc32koopman":
        h = crc32.New(crc32.MakeTable(crc32.Koopman))
    case "crc64", "crc64iso":
        h = crc64.New(crc64.MakeTable(crc64.ISO))
    case "crc64ecma":
        h = crc64.New(crc64.MakeTable(crc64.ECMA))
    case "fnv", "fnv32":
        h = fnv.New32()
    case "fnv32a":
        h = fnv.New32a()
    case "fnv64":
        h = fnv.New64()
    case "fnv64a":
        h = fnv.New64a()
    case "hmac", "hmacsha256":
        h = hmac.New(sha256.New, []byte(key))
    case "hmacmd5":
        h = hmac.New(md5.New, []byte(key))
    case "hmacsha1":
        h = hmac.New(sha1.New, []byte(key))
    case "hmacsha512":
        h = hmac.New(sha512.New, []byte(key))
    case "md4":
        h = md4.New()
    case "md5":
        h = md5.New()
    case "ripemd160":
        h = ripemd160.New()
    case "sha1":
        h = sha1.New()
    case "sha224":
        h = sha256.New224()
    case "sha256":
        h = sha256.New()
    case "sha384":
        h = sha512.New384()
    case "sha512":
        h = sha512.New()
    default:
        return nil, errors.New("Invalid algorithm")
    }
    return h, nil
}

开发者ID:patrickmn,项目名称:picugen,代码行数:52,代码来源:picugen.go

示例2: makeHash

func makeHash(name string) hash.Hash {
    switch strings.ToLower(name) {
    case "ripemd160":
        return ripemd160.New()
    case "md4":
        return md4.New()
    case "md5":
        return md5.New()
    case "sha1":
        return sha1.New()
    case "sha256":
        return sha256.New()
    case "sha384":
        return sha512.New384()
    case "sha3-224":
        return sha3.New224()
    case "sha3-256":
        return sha3.New256()
    case "sha3-384":
        return sha3.New384()
    case "sha3-512":
        return sha3.New512()
    case "sha512":
        return sha512.New()
    case "sha512-224":
        return sha512.New512_224()
    case "sha512-256":
        return sha512.New512_256()
    case "crc32-ieee":
        return crc32.NewIEEE()
    case "crc64-iso":
        return crc64.New(crc64.MakeTable(crc64.ISO))
    case "crc64-ecma":
        return crc64.New(crc64.MakeTable(crc64.ECMA))
    case "adler32":
        return adler32.New()
    case "fnv32":
        return fnv.New32()
    case "fnv32a":
        return fnv.New32a()
    case "fnv64":
        return fnv.New64()
    case "fnv64a":
        return fnv.New64a()
    case "xor8":
        return new(xor8)
    case "fletch16":
        return &fletch16{}
    }
    return nil
}

开发者ID:qeedquan,项目名称:misc_utilities,代码行数:51,代码来源:checksum.go

示例3: NewSpecialCollectionCache

func NewSpecialCollectionCache(intent *intents.Intent, demux *Demultiplexer) *SpecialCollectionCache {
    return &SpecialCollectionCache{
        Intent: intent,
        Demux:  demux,
        hash:   crc64.New(crc64.MakeTable(crc64.ECMA)),
    }
}

开发者ID:Machyne,项目名称:mongo,代码行数:7,代码来源:demultiplexer.go

示例4: hashcrc64

func hashcrc64(s []byte) []byte {
    var tab = crc64.MakeTable(crc64.ECMA)
    h := crc64.New(tab)
    h.Write(s)

    return h.Sum(nil)
}

开发者ID:sevki,项目名称:Posts,代码行数:7,代码来源:main.go

示例5: main

func main() {
    var ECMATable = crc64.MakeTable(crc64.ECMA)
    h := crc64.New(ECMATable)
    h.Write([]byte("test"))
    v := h.Sum64()
    fmt.Println(v)
}

开发者ID:purepennons,项目名称:startLearnGolang,代码行数:7,代码来源:useCrc64.go

最后编辑: kuteng  文档更新时间: 2021-08-23 19:14   作者:kuteng