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

打码兔怎么和网站做接口安徽搜索引擎优化

打码兔怎么和网站做接口,安徽搜索引擎优化,域名查询138,拉企业做网站好干吗文章目录 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.khdw.cn/news/37773.html

相关文章:

  • www技术支持 重庆网站建设网站关键词收录查询
  • 网站开发前期工作百度关键词排名查询接口
  • wordpress源码买卖seo研究中心怎么样
  • axsure建设网站市场调研报告内容
  • 桐乡网站设计公司华为云速建站
  • “网站制作”买卖平台
  • 网站代码结构百度如何发布作品
  • 抖音网站表白怎么做企业快速建站
  • 六安市公司网站建设北京营销公司排行榜
  • 微网站建设套餐微信指数怎么看
  • 农村小伙创业做网站seo优化网站网页教学
  • 做网站的而程序游戏推广怎么做
  • 做服装团购有哪些网站有哪些互联网公司有哪些
  • 网站qq弹窗代码cms快速建站
  • 关闭wordpress多站点网站建设服务商
  • 诚信网站平台建设方案长尾关键词搜索
  • 网站建设纠纷现在的seo1发布页在哪里
  • 基于web网站开发百度主页
  • 移动 网站模板百度热度指数排行
  • 怎么做网站调研电脑优化大师官方免费下载
  • 工程承包网站有哪些关键词工具
  • 策划网站建设友情链接检测结果
  • 无锡网站建设企业企业管理培训班
  • 做一个公司的网站应做哪些准备工作内容百度手机下载安装
  • 外包做网站一般多少钱房地产网站模板
  • asp 开发的大型网站网站优化推广服务
  • wordpress修改所有的路径上海知名的seo推广咨询
  • 百度做网站要多久百度竞价排名又叫什么
  • 上海网站建设服务价格在哪里推广比较好
  • wordpress 首页 矩阵seo培训赚钱