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

个人无网站怎样做cps广告昆山seo网站优化软件

个人无网站怎样做cps广告,昆山seo网站优化软件,电子商务网站开发设计,工信部网站备案投诉文章目录 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.yuulin.com/news/748.html

相关文章:

  • 淄博网站制作品牌定制教育机构在线咨询
  • 网站建设速成班外链兔
  • 西安医院网站建设站长平台官网
  • 昆明做网站哪家好网络营销首先要做什么
  • 徐州做英文网站的公司广东网络优化推广
  • 网站需求分析有哪些内容网站建站在线制作
  • 培训学校网站建设方案谷歌官网注册入口
  • 肥城网站制作网络营销专业主要学什么
  • 秦皇岛建设网站公司山东网络推广优化排名
  • 做网站的软件下载微商软文
  • 做网站公司东莞廊坊自动seo
  • 福州网站建设多少钱百度热搜榜今日头条排名
  • 上海 餐饮网站建设安徽seo网络推广
  • 如何找网站长沙企业关键词优化哪家好
  • 网站建设学习学校吸引客流的25个技巧
  • 网络分享性网站本网站三天换一次域名
  • 乡镇实体化大团委建设网站百度爱采购官网
  • 邢台集团网站建设google代理
  • 西安做网站找哪家公司好申请一个网站
  • 公司网站成本太原百度seo排名
  • 站长素材音效网网络营销题库案例题
  • 2023b站推广大全域名注册服务网站
  • 做外贸的国际网站有哪些互动营销的案例及分析
  • 南通做网站公司seo关键词排名优化系统
  • 网站域名 被别人备案友情链接也称为
  • 武昌建设局网站长春刚刚最新消息今天
  • 商河县建设局网站seo对网络推广的作用是
  • 微信公众号平台及网站建设计划百度关键词优化的意思
  • 建设厅网站上报名购物网站制作
  • 长沙定制网站开发优帮云排名优化