13-amaliy mashg’ulot Mavzu: Gomomorfik shifr algoritmlari bilan ishlash. Ochiq kalitli kriptotizimlar uchun gamomorflik xususiyatlarini dasturiy tomondan tekshirish. Ishdan maqsad


Gomomorfik kriptotizimlarning kelib chiqishi


Download 114.18 Kb.
bet4/4
Sana20.08.2023
Hajmi114.18 Kb.
#1668606
1   2   3   4
Bog'liq
13-amali

Gomomorfik kriptotizimlarning kelib chiqishi.
Gomomorfik shifrlashning kelib chiqishi 1978 yilda Rivest, Shamir va Adleman texnologiya dunyosida uzoq vaqtdan beri mavjud bo‘lgan shifrlashdan keyin paydo bo‘ldi. Rivest, Adleman va Dertouzos shaxsiy hayotdagi homomorfizm tushunchasini ishlab chiqdilar. Ularning shifrlash haqidagi tushunchasi taxminan 10 yildan keyin Brikel va Yakobi tomonidan urib tushirilgan. Boshqa tadqiqotchilar bu masalani "sinab ko‘rishdi" - masalan, Feygenbaum va Merritt - ammo Stenford universitetining aspiranti Gentri o‘zining diplom ishi sifatida algebraik ravishda gomomorfik shifrlash tizimini yaratishda qo‘lini sinab ko‘rishga qaror qilmaguncha, haqiqatan ham sezilarli yutuqlarga erishilmadi. Gentri, Makartur fondining hurmatli tadqiqotchisi va Tomas J. Vatsonning tadqiqot markazidagi kriptografiya bo‘yicha tadqiqot guruhi, birinchi to‘liq homomorfik shifrlash sxemasini 2009 yilda yaratdi. Uning izlanishlari keyingi yillarda homomorfik shifrlash sxemalarining boshqa variantlari bilan izohlandi.
Yakuniy fikrlar
Gomomorfik shifrlash kontseptsiyasi, xususan, to‘liq homomorfik shifrlash - turli sohalarda haqiqiy amaliy dasturlar uchun juda istiqbolli. Ammo hiyla-nayrang - bu qo‘shimcha xarajatlarni kamaytirish va undan katta hajmda foydalanish jarayonini tezlashtirish. Gommomorfik shifrlash sohasida erishilgan yutuqlardan qat’i nazar, siz omborxonadagi ma’lumotlaringizni va uzatish paytida himoyada saqlanadigan ma’lumotni ham, shu vaqtning o‘zida ham e’tiborsiz qoldirmaslik juda muhimdir.
Cryptool laboratoriyasida amaiy topshiriqlar bajariladi.
Topshiriq
RSA algoritmining gommomorfik xususiyatlarini dasturiy ko’rinishda amalga oshirish.
Nazorat savollari

  1. Gomomorf shifrlash qanday algortim

  2. Gomomorf shifrlashning qanday turlari mavjun

  3. Qaysi shifrlash algoritmlari gomomorf algoritm bo’la oladi.

  4. Gomomorf shifrlash algortimlari qayerlarda

import math


# Function to perform modular exponentiation
def modExp(base, exponent, modulus):
if exponent == 0:
return 1

result = 1


value = base

while exponent > 0:


if exponent % 2 == 1:
result = (result * value) % modulus

value = (value * value) % modulus


exponent //= 2

return result


# Function to perform homomorphic addition


def homomorphicAddition(ciphertext1, ciphertext2, publicKey, modulus):
product = (ciphertext1 * ciphertext2) % modulus
result = modExp(product, publicKey, modulus)
return result

# Function to perform homomorphic multiplication


def homomorphicMultiplication(ciphertext, scalar, publicKey, modulus):
exponentiatedScalar = modExp(scalar, publicKey, modulus)
result = modExp(ciphertext, exponentiatedScalar, modulus)
return result

# Function to perform RSA encryption


def rsaEncrypt(plaintext, publicKey, modulus):
return modExp(plaintext, publicKey, modulus)

# Function to perform RSA decryption


def rsaDecrypt(ciphertext, privateKey, modulus):
return modExp(ciphertext, privateKey, modulus)

# RSA key pair generation (public key and private key)


# Generate RSA key pair
p = 19 # Prime number
q = 13 # Prime number

n = p * q # Modulus


phi = (p - 1) * (q - 1) # Euler's totient function

e = 7 # Public key


d = 1 # Private key


while (d * e) % phi != 1:
d += 1

# Encryption


plaintext = 40
ciphertext = rsaEncrypt(plaintext, e, n)

print("Ciphertext:", ciphertext)


# Decryption


decrypted = rsaDecrypt(ciphertext, d, n)

print("Decrypted:", decrypted)


# Encryption


plaintext1 = 10
plaintext2 = 7
publicKey = e
privateKey = d
ciphertext1 = modExp(plaintext1, publicKey, n)
ciphertext2 = modExp(plaintext2, publicKey, n)

# Homomorphic addition


additionResult = homomorphicAddition(ciphertext1, ciphertext2, publicKey, n)

# Homomorphic multiplication


scalar = 5
multiplicationResult = homomorphicMultiplication(ciphertext1, scalar, publicKey, n)

# Decryption


decryptedAdditionResult = modExp(additionResult, privateKey, n)
decryptedMultiplicationResult = modExp(multiplicationResult, privateKey, n)

# Print results


print("Homomorphic Addition Result:", decryptedAdditionResult)
print("Homomorphic Multiplication Result:", decryptedMultiplicationResult)



Download 114.18 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling