You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
352 B
24 lines
352 B
3 years ago
|
package srp
|
||
|
|
||
|
import (
|
||
|
"math/big"
|
||
|
|
||
|
"github.com/gotd/td/internal/crypto"
|
||
|
)
|
||
|
|
||
|
func (s SRP) pad256FromBig(i *big.Int) (b [256]byte, r bool) {
|
||
|
r = crypto.FillBytes(i, b[:])
|
||
|
return b, r
|
||
|
}
|
||
|
|
||
|
func (s SRP) pad256(b []byte) [256]byte {
|
||
|
if len(b) >= 256 {
|
||
|
return *(*[256]byte)(b[len(b)-256:])
|
||
|
}
|
||
|
|
||
|
var tmp [256]byte
|
||
|
copy(tmp[256-len(b):], b)
|
||
|
|
||
|
return tmp
|
||
|
}
|