首页 文章

Node crypto包中的crypto.randomBytes(32)的Golang中的等价物是什么?

提问于
浏览
0

嗨伙计们我基本上都在尝试重新创建这个节点包:

https://github.com/seishun/node-steam-crypto/blob/master/index.js

golang 中,我可以对Steam API进行API调用,这需要这些加密的 sessionKeys ,而不是 .

我正在查看 crypto 包,但有很多不同的散列方法可供使用我不确定哪一个最接近

crypto.randomBytes(32) 在节点包中 .

还有

crypto.publicEncrypt()

对不起,如果这个问题是垃圾,不知道怎么说话,因为我之前没有真正处理过这类问题 . 任何信息都会非常感谢 .

1 回答

  • 4

    rand.Read

    import "crypto/rand"
    …
    b := make([]byte, 32)
    _, err := rand.Read(b)
    

相关问题