Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

SEME data

30 views
%auto typeset_mode(True, display=False)
from sage.crypto.block_cipher.sdes import SimplifiedDES sdes = SimplifiedDES() sdes bin = BinaryStrings() P = bin.encoding("Input your message here") Key = [1, 0, 0, 0, 0, 0, 0, 1, 1, 0] K = sdes.list_to_string(Key) C = sdes(P, K, algorithm="encrypt") C
Simplified DES block cipher with 10-bit keys
11101010101111110010001011000001011000110010001111101111110001101100000111011111001000110000011110011101000010100000101011111000011010001001110100100011010011011001110111011111100111010010001110111010011111001110101010111111001000101100000101100011001000111110111111000110110000011101111100100011000001111001110100001010000010101111100001101000100111010010001101001101100111011101111110011101001000111011101001111100
from sage.crypto.block_cipher.miniaes import MiniAES maes = MiniAES() output_length = 16 key = [2, 3, 11, 0] key = maes.integer_to_binary(key) C = "" for i in range(output_length): P = [n for n in range(i, i +16)] for j in range(16): P[j] = P[j] % 16 P = maes.integer_to_binary(P); C = C + [maes(P, key, algorithm="encrypt")] C
Error in lines 7-12 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags) in namespace, locals File "", line 6, in <module> TypeError: cannot concatenate 'str' and 'list' objects
S = ShiftCryptosystem(BinaryStrings()) P = S.encoding("aaaaaaa") Key = 1 #must be between 1 and 25 C = S.enciphering(Key, P) str_c = str(C) for i in range(): if C[i] == "0": C_int[i] = 0 if C[i] == "1": C_int[i] = 1 C_int
Error in lines 3-3 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1188, in execute flags=compile_flags) in namespace, locals File "", line 1, in <module> NameError: name 'length' is not defined
from sage.crypto.mq.rijndael_gf import RijndaelGF bin_string = "" rgf = RijndaelGF(4, 6) length = 4 key = '000102030405060708090a0b0c0d0e0f1011121314151617' # a random key for i in range(length): plaintext = '{0:0{1}x}'.format(i,32) C = rgf.encrypt(plaintext, key) C = int(C, 16) bin_string = bin_string + "{0:0{1}b}".format(C,128) bin_string
10010001011000100101000110000010000111000111001110100101001000101100001110010110110101100010011100111000000000011001011000000111010010010100111000111000010110100100101100111111101011111011011100010011111010101110110010101000000010000110001001100111000101111101101100000011000100101000101110110111010011010010010000101100100000110100001001000010001001101111011111001010001001011100011010011011011100101001111010100101011100010001111010101010010101100001101100001101100100111101111110000101110000111010001110000110