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

Recommended Answers

All 3 Replies

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))

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.