by Glenn Larsson (5 Submissions)
Category: Math/Dates
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Mon 15th November 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Diffie Hellman Algorithm
'
' Disclaimer:
' No prime number testing included. This is not an encryption system, it's
' a part of one (generates only <= ~32 bit keys)
'
' Note:
' -----
' (P ^ QtoP) ^ N = This generates Overflow, So i tweaked it to:
' ((QtoP * P) Mod M) * N = This works.
'
' ******** Shame on MS for lousy large number support in VB ********
'
' For Recreational/Educational use only
' Code (C) Glenn Larsson ([email protected])
' (All emails asking for support = Thrown away, Read Applied Cryptography!)
' ------------------------------------------------------------------------------
P = Int(Rnd(256) * 256)
Q = Int(Rnd(256) * 256)
N = Int(Rnd(256) * 256)
M = Int(Rnd(256) * 65536)
PtoQ = (P * N) Mod M
QtoP = (Q * N) Mod M
P's Key = ((QtoP * P) Mod M) * N
Q's Key = ((PtoQ * Q) Mod M) * N