Lib that abstracts the encryption algorithms used by golang.
The goal is to further facilitate the native ualization of existing libs in Go.
We use numbers like CBC, CFB, GCM, OFB, MD5, BLOWFISH etc.
- gcry
- example
- main-blofish-uid-rand.go
- main-blofish.go
- main-cbc.go
- main-cfb.go
- main-gcm.go
- main-hash-file.go
- main-sh1.go
- main-uid-rand.go
- api-blofish-uid-rand.go
- api-blofish.go
- api-cbc.go
- api-cfb.go
- api-gcm.go
- api-hash-file.go
- api-sh1.go
- api-uid-rand.go
package main
import (
"fmt"
gcry "github.com/jeffotoni/gcry"
)
fsunc main() {
textCry := gcry.EncryptGCM("Let's encrypt our text here.")
fmt.Println(textCry)
textDescry := gcry.DecryptGCM(textCry)
fmt.Println(textDescry)
}
package main
import (
"fmt"
gcry "github.com/jeffotoni/gcry"
)
//
//
//
func main() {
cipherText := gcry.EncryptCFB("new functional ex: of crifra CFB ")
fmt.Println(cipherText)
textplan := gcry.DecryptCFB(cipherText)
fmt.Println(textplan)
}
package main
import (
"fmt"
gcry "github.com/jeffotoni/gcry"
)
//
//
//
func main() {
// multiple 16 len text
cipherText := gcry.EncryptCBC("new functional ex: of crifra CBC")
fmt.Println(cipherText)
textplan := gcry.DecryptCBC(cipherText)
fmt.Println(textplan)
}
package main
import (
"fmt"
gcry "github.com/jeffotoni/gcry"
)
func main() {
fmt.Println(gcry.UidRand())
}
package main
import (
"fmt"
gcry "github.com/jeffotoni/gcry"
)
func main() {
password := "1234567890#$"
hash := gcry.Sha1(password)
fmt.Println(hash)
}
package main
import (
"fmt"
gcry "github.com/jeffotoni/gcry"
)
func main() {
password := "1234567890#$"
hashBlo := gcry.Blowfish(password)
if gcry.CheckBlowfish(password, hashBlo) {
fmt.Println("ok, password correct!")
} else {
fmt.Println("ok, password incorrect!")
}
}
package main
import (
"fmt"
gcry "github.com/jeffotoni/gcry"
)
func main() {
fmt.Println(gcry.BlowfishUid())
}
package main
import (
"fmt"
gcry "github.com/jeffotoni/gcry"
)
func main() {
hash, _ := gcry.HashFile("main-cbc.go")
fmt.Println(hash)
}
package main
import (
"fmt"
gcry "github.com/jeffotoni/gcry"
)
func main() {
password := "1234567890#$"
hash := gcry.Sha256(password)
}
It is possible to encrypt files, ie your content will be encrypted and generated a new file.
package main
import (
"fmt"
gcry "github.com/jeffotoni/gcry"
)
func main() {
fileCry := gcry.EncryptOFBFile("main-cbc.go")
fmt.Println(fileCry)
fileDecry := gcry.DecryptOFBFile(fileCry)
fmt.Println(fileDecry)
}