Datsik
Datsik

Reputation: 14824

What would be the equivalent in Golang of crypto.randomBytes(32) in the Node crypto package?

Hi guys I'm basically trying to recreate this node package:

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

In golang so I can make API calls to the Steam API that requires these encrypted sessionKeys and what not.

I was looking through the crypto package but there is so many different hashing methods to use I'm not sure which one would be the closest to the

crypto.randomBytes(32) in the node package.

Also the

crypto.publicEncrypt()

Sorry if this question is crap, not sure how else to word it as I haven't really dealt with this kind of stuff before. Any information would be great thanks.

Upvotes: 1

Views: 696

Answers (1)

Ry-
Ry-

Reputation: 225005

rand.Read:

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

Upvotes: 5

Related Questions