Generate Agreement
| 72 | |
| 73 | // Generate Agreement |
| 74 | void DH::Agree(byte* agree, const byte* priv, const byte* otherPub, word32 |
| 75 | otherSz) |
| 76 | { |
| 77 | const word32 bc(p_.ByteCount()); |
| 78 | Integer x(priv, bc); |
| 79 | Integer y; |
| 80 | if (otherSz) |
| 81 | y.Decode(otherPub, otherSz); |
| 82 | else |
| 83 | y.Decode(otherPub, bc); |
| 84 | |
| 85 | Integer z(a_exp_b_mod_c(y, x, p_)); |
| 86 | z.Encode(agree, bc); |
| 87 | } |
| 88 | |
| 89 | |
| 90 | DH::DH(Source& source) |