summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-01-31 00:27:37 +0100
committerWim <wim@42.be>2022-03-20 14:57:48 +0100
commite3cafeaf9292f67459ff1d186f68283bfaedf2ae (patch)
treeb69c39620aa91dba695b3b935c6651c0fb37ce75 /vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519
parente7b193788a56ee7cdb02a87a9db0ad6724ef66d5 (diff)
downloadmatterbridge-msglm-e3cafeaf9292f67459ff1d186f68283bfaedf2ae.tar.gz
matterbridge-msglm-e3cafeaf9292f67459ff1d186f68283bfaedf2ae.tar.bz2
matterbridge-msglm-e3cafeaf9292f67459ff1d186f68283bfaedf2ae.zip
Add dependencies/vendor (whatsapp)
Diffstat (limited to 'vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519')
-rw-r--r--vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519/curve.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519/curve.go b/vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519/curve.go
deleted file mode 100644
index 5ddf9c9a..00000000
--- a/vendor/github.com/Rhymen/go-whatsapp/crypto/curve25519/curve.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-In cryptography, Curve25519 is an elliptic curve offering 128 bits of security and designed for use with the elliptic
-curve Diffie–Hellman (ECDH) key agreement scheme. It is one of the fastest ECC curves and is not covered by any known
-patents. The reference implementation is public domain software. The original Curve25519 paper defined it
-as a Diffie–Hellman (DH) function.
-*/
-package curve25519
-
-import (
- "crypto/rand"
- "golang.org/x/crypto/curve25519"
- "io"
-)
-
-/*
-GenerateKey generates a public private key pair using Curve25519.
-*/
-func GenerateKey() (privateKey *[32]byte, publicKey *[32]byte, err error) {
- var pub, priv [32]byte
-
- _, err = io.ReadFull(rand.Reader, priv[:])
- if err != nil {
- return nil, nil, err
- }
-
- priv[0] &= 248
- priv[31] &= 127
- priv[31] |= 64
-
- curve25519.ScalarBaseMult(&pub, &priv)
-
- return &priv, &pub, nil
-}
-
-/*
-GenerateSharedSecret generates the shared secret with a given public private key pair.
-*/
-func GenerateSharedSecret(priv, pub [32]byte) []byte {
- var secret [32]byte
-
- curve25519.ScalarMult(&secret, &priv, &pub)
-
- return secret[:]
-}