package obfuscated2
import (
"crypto/aes"
"crypto/cipher"
"encoding/binary"
"io"
)
func createCTR (key , iv []byte ) (cipher .Stream , error ) {
block , err := aes .NewCipher (key )
if err != nil {
return nil , err
}
return cipher .NewCTR (block , iv ), nil
}
func getDecryptInit (init []byte ) (initRev [48 ]byte ) {
copy (initRev [:], init [8 :56 ])
for left , right := 0 , len (initRev )-1 ; left < right ; left , right = left +1 , right -1 {
initRev [left ], initRev [right ] = initRev [right ], initRev [left ]
}
return
}
func generateInit (randSource io .Reader ) (init [64 ]byte , err error ) {
for {
_, err = io .ReadFull (randSource , init [:])
if err != nil {
return [64 ]byte {}, err
}
if init [0 ] == 0xef {
continue
}
firstInt := binary .LittleEndian .Uint32 (init [0 :4 ])
if firstInt == 0x44414548 ||
firstInt == 0x54534f50 ||
firstInt == 0x20544547 ||
firstInt == 0x4954504f ||
firstInt == 0x02010316 ||
firstInt == 0xdddddddd ||
firstInt == 0xeeeeeeee {
continue
}
if secondInt := binary .LittleEndian .Uint32 (init [4 :8 ]); secondInt == 0 {
continue
}
break
}
return init , nil
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .