PYTHON CODE
PYTHON CODE
import math
def calculate_entropy(password):
# Entropiyani hisoblash
password_length = len(password)
character_set = set(password)
character_set_size = len(character_set)
entropy = password_length * math.log2(character_set_size)
return entropy
def check_password_strength(password):
# Entropiyani olish
entropy = calculate_entropy(password)
# Olingan entropiyani binoan xavfsizlik darajasini
baholash
if
entropy < 28:
return “Xavfsizlik darajasi: Kam”
elif entropy < 36:
return “Xavfsizlik darajasi: O’rtacha”
else:
return “Xavfsizlik darajasi: Yaxshi”
import math
def calculate_entropy(password):
# Entropiyani hisoblash
password_length = len(password)
character_set = set(password)
character_set_size = len(character_set)
entropy = password_length * math.log2(character_set_size)
return entropy
def check_password_strength(password):
# Entropiyani olish
entropy = calculate_entropy(password)
# Olingan entropiyani binoan xavfsizlik darajasini baholash
if entropy < 28:
return “Xavfsizlik darajasi: Kam”
elif entropy < 36:
return “Xavfsizlik darajasi: O’rtacha”
else:
return “Xavfsizlik darajasi: Yaxshi”