当前位置: 首页 > news >正文

打码兔怎么和网站做接口怎么策划一个营销方案

打码兔怎么和网站做接口,怎么策划一个营销方案,网站下载不了视频,wordpress链接提交文章目录 Go 语言 big.Int应用场景:大整数位运算使用举例: go sdk中crypto/ecdsa 椭圆曲线生成私钥相关结构中就有使用 Go 语言 big.Int Go 语言 big.Int 参考URL: https://blog.csdn.net/wzygis/article/details/82867793 math/big 作为 Go 语言提供的…

文章目录

    • Go 语言 big.Int
    • 应用场景:大整数位运算
    • 使用举例: go sdk中crypto/ecdsa 椭圆曲线生成私钥相关结构中就有使用

Go 语言 big.Int

Go 语言 big.Int
参考URL: https://blog.csdn.net/wzygis/article/details/82867793

math/big 作为 Go 语言提供的进行大数操作的官方库。

big.Int 用于表示 大整数。

应用场景:大整数位运算

在密码学、加密算法或者需要处理大数字的领域中,使用大整数进行位操作是非常常见的。

实战demo:来自cosmos的 bip39.go

  ...// Break entropy up into sentenceLength chunks of 11 bits// For each word AND mask the rightmost 11 bits and find the word at that index// Then bitshift entropy 11 bits right and repeat// Add to the last empty slot so we can work with LSBs instead of MSB// Entropy as an int so we can bitmask without worrying about bytes slicesentropyInt := new(big.Int).SetBytes(entropy)// Slice to hold words inwords := make([]string, sentenceLength)// Throw away big int for AND maskingword := big.NewInt(0)for i := sentenceLength - 1; i >= 0; i-- {// Get 11 right most bits and bitshift 11 to the right for next timeword.And(entropyInt, Last11BitsMask)entropyInt.Div(entropyInt, RightShift11BitsDivider)// Get the bytes representing the 11 bits as a 2 byte slicewordBytes := padByteSlice(word.Bytes(), 2)// Convert bytes to an index and add that word to the listwords[i] = WordList[binary.BigEndian.Uint16(wordBytes)]}return strings.Join(words, " "), nil
}

代码解析:

entropyInt := new(big.Int).SetBytes(entropy) 这行代码的作用是将字节切片 entropy 转换为大整数。

将这些字节数据转换为大整数可以方便进行位操作、数学运算等操作,同时也能保持精度和范围。因此,将字节转换为大整数是一种常见的做法

  • 将熵(entropy)分成长度为 sentenceLength 的 11 位比特。
  • 对于每个单词,将最右边的 11 位进行按位与(AND)运算,并找到该索引位置的单词。
  • 然后将熵向右移动 11 位,重复上述操作。

使用举例: go sdk中crypto/ecdsa 椭圆曲线生成私钥相关结构中就有使用

举例:
比如 go sdk中crypto/ecdsa 椭圆曲线生成私钥相关结构中就有使用到,demo如下:
key, err := ecdsa.GenerateKey(secp256k1.S256(), seed)

// PublicKey represents an ECDSA public key.
type PublicKey struct {elliptic.CurveX, Y *big.Int
}// PrivateKey represents an ECDSA private key.
type PrivateKey struct {PublicKeyD *big.Int
}
http://www.hrbkazy.com/news/3587.html

相关文章:

  • 中铁建设集团有限公司电话百度推广优化中心
  • 学生制作网站建设 维护百度网站链接
  • 用ih5做微网站最好的网站设计公司
  • 音视频娱乐网站开发商怎么免费注册域名
  • dedecms手机网站制作站长工具seo综合查询权重
  • 西乡城建局网站百度搜索开放平台
  • 电子商务网站建设目的上海十大营销策划公司排名
  • 对网站开发流程的认识网络运营培训班
  • 网站开发类型win10优化大师官网
  • 网站建设通知书国家卫健委:不再发布每日疫情信息
  • 制作网页改颜色网站seo关键词排名推广
  • 网站开发制作案例seo必备工具
  • 网站安全措施经典广告推广词
  • 动态网站课程和网站建设课程互联网营销模式有哪些
  • 官方网站的域名搜什么关键词你都懂的
  • 网站建设的技术风险郑州好的seo外包公司
  • 企业网站的制作成本平台连接
  • 运城手机网站制作cpa推广联盟平台
  • 南通做网站的花云河南疫情最新消息
  • 做网站先做前端好还是先做逻辑nba最新资讯
  • 怎样推广一个网站百度最新财报
  • 各大网站做推广的广告怎么做seo网站优化
  • 唐山公司网站建设 中企动力唐山宁波seo免费优化软件
  • 尖扎网站建设公司百度推销广告一年多少钱
  • 龙岗房价北京网优化seo优化公司
  • 建云购网站中国企业500强最新排名
  • 做期货浏览哪些网站淘宝搜索关键词查询工具
  • 做试用网站的原理网站排名推广推荐
  • 360客服做网站电话网站查询域名
  • 十堰微网站建设多少钱济南seo公司报价