Steganografiya quyidagi sohalarda qo'llaniladi, lekin ular bilan cheklanmaydi



Download 45,83 Kb.
bet12/40
Sana14.04.2022
Hajmi45,83 Kb.
#551350
1   ...   8   9   10   11   12   13   14   15   ...   40
Bog'liq
sregono

triggers = {}

WM_X = np.array(ownership['inputs'])
nb_blocks = min(self.nb_blocks, len(WM_X))

step = floor(len(WM_X) / nb_blocks)
# For each block
for block in range(0, nb_blocks):
# Generate the encryption key
key = Fernet.generate_key()
# Add the key to the key set
keys.append(key)
# Initiating the encryption object based on the key
f = Fernet(key)
# Encrypt / store
to_encrypt = WM_X[block * step:(block + 1) * step].tobytes()
encrypted_trigger = f.encrypt(to_encrypt)
triggers['block_' + str(block)] = encrypted_trigger
shape_x, shape_y = WM_X.shape
triggers['shape'] = (int(shape_x / nb_blocks), shape_y)
triggers['dtype'] = WM_X.dtype

encrypted_trigger = {'triggers': triggers, 'keys': keys}

return encrypted_trigger

def decrypt_trigger(self, triggers, block_id, key):
""" Decrypt trigger block

Args:
triggers (dict): Encrypted trigger information
block_id (int): Trigger block to decrypt
key (str): Decryption key

Returns:
clear_trigger (array): Decrypted trigger

"""
shape = triggers['shape']
dtype = triggers['dtype']
f = Fernet(key)
clear_trigger = f.decrypt(triggers['block_' + str(block_id)])
clear_trigger = np.frombuffer(clear_trigger, dtype=dtype)
return clear_trigger.reshape(shape)

import hashlib
import hmac
import random
import warnings
from math import floor

import bitstring
import numpy as np
import pyfiglet
import torch

Download 45,83 Kb.

Do'stlaringiz bilan baham:
1   ...   8   9   10   11   12   13   14   15   ...   40




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish