当前位置: 首页 > 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.hkea.cn/news/127650/

相关文章:

  • 新疆兵团建设网站商丘seo优化
  • 手机微信网站怎么做的软文发布网站
  • 传奇手游发布网站seo排名优化方式
  • 网站建设明细报价外链信息
  • 哪个网站做漫画可以有钱营销型网站设计
  • wordpress在线视频直播湖南正规关键词优化
  • 花木企业网站源码全网推广的方式
  • 网站开发商怎么关闭图片显示站长之家新网址
  • 灯饰如何做网站推广纯手工seo公司
  • 晋中公司做网站seo站长之家
  • 到哪里找人做网站优化seo培训班
  • 深圳网站开发哪家专业搜索到的相关信息
  • 湖北武汉网站制作引擎搜索下载
  • 做网站登录的需求分析seo点击排名工具有用吗
  • 诸暨住房和城乡建设委员会网站怎么制作网站?
  • 昆明cms建站模板视频号排名优化帝搜软件
  • 商务咨询网站源码重庆网站建设哪家好
  • 建设部网站从何时可以查询工程师证深圳全网推广服务
  • 网页制作工具的选择与网站整体风格是有关系的友情链接论坛
  • 免费商会网站模板百度推广账号
  • 玄武模板网站制作品牌关键词排名点击软件网站
  • 网站title的写法微信软文怎么写
  • 设计企业网站流程磁力引擎
  • 橙色企业网站模板域名注册购买
  • 培训建设网站线上推广产品
  • 写作网站不屏蔽全网关键词指数查询
  • wordpress手机uiseo关键词的选择步骤
  • 自己制作网页的步骤windows优化大师在哪里
  • 黑龙江企业信息系统seo推广优化外包公司
  • wordpress+增加域名赣州网站seo