GenerateMutualKey : generates a mutual key that can be used by only alice and bob mutualKey = (shareKey^prvKey)%primeNumber
(prvKey, shareKey int64)
| 21 | // GenerateMutualKey : generates a mutual key that can be used by only alice and bob |
| 22 | // mutualKey = (shareKey^prvKey)%primeNumber |
| 23 | func GenerateMutualKey(prvKey, shareKey int64) int64 { |
| 24 | return modularExponentiation(shareKey, prvKey, primeNumber) |
| 25 | } |
| 26 | |
| 27 | // r = (b^e)%mod |
| 28 | func modularExponentiation(b, e, mod int64) int64 { |