0

Hi is here any one who can tell me that how can i generate the licence key or any other things for securing my client server program please help me

Edited by Atul_4: syntax missing

4
Contributors
3
Replies
33
Views
3 Years
Discussion Span
Last Post by snippsat
0

use the random module and a for loop like this.

import random

ll = "a;b;c;d;e;f;g;h;i;j;k;l;m;n;o;p;q;r;s;t;u;v;w;x;y;z"
ul = "A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z"
key = []
finalKey = []
finalKeyStr = ""
lettersList = ll.split(";") + ul.split(";")

for number in range(0, 100):
    key.append(str(random.randint(1, 26)))

for letter in range(0, 100):
    key.append(str(random.choice(lettersList)))

for char in key:
    rl = random.choice(key)
    key.remove(rl)
    finalKey.append(rl)

for char in finalKey:
    finalKey.remove(char)
    finalKeyStr += char

print(str(finalKeyStr))
0

Python do have build in libraries that can generate key which hold cryptographic strength.
Her use SHA-256

>>> import hashlib
>>> hashlib.sha256(b"licence key").hexdigest()
'ad26f374a671d9add68a110b31769667691a54ed599e791b5c8eb065b16c9ddc'

Will also metion cryptography which is the future for cryptographic in Python.

Edited by snippsat

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.