Professional Documents
Culture Documents
Biomedical informatics
University of Ljubljana, Faculty of Electrical
Engineering
Autor:
dr. Tomaž Vrtovec Koldo Eizmendi Gallastegui
Laboratory of Imaging Technologies Registration number: 70081273
Academic year: 2018/2019
University of Ljubljana, Faculty of Electrical Engineering Koldo Eizmendi Gallastegui
Laboratory of Imaging Technologies
Biomedical informatics 2018/2019
Question 1
This question asks to encrypt the text ’Biomedical informatics’ using ’encryption’ for the encryption
key and Base64 encoding. The code used is the same as the one written in the lab.
p9fS397U3czQ2oXX0djo4uHK49fI4Q
QmlvbWVkaWNhbCBpbmZvcm1hdGljcw
Question 2
This question asks to decrypt the ciphertext
'uM3M5ZnZ54m7z8aFuuHr25S33pyEmYPX5+Td3dvTyIWm5PLg6NjW4MXVy+uZ1uPbj+LMyoPl7tLezt
LihKfM4ebV2NLSz9CFrODf3+bW0OLNyNag' using the key ’decryption’. The code used is the same as
the one written in the lab. The plaintext obtained is:
This is Lab Work No. 4 entitled Cryptography for the subject Biomedical Informatics.
Question 3
This third question asks to do some calculations related to the length in bytes of th texts obtained in
questions 1 and 2.
Plaintext: ’biomedical informatics’
Using the function length() we can see that ’biomedical informatics’ is has a total of 22 characters.
This means that it has 22 bytes or 22*8=176 bits.
Encoded text
The length of the encoded text is 30. This can be seen using once again the function length. However,
it is not really necessary to use that function, the length can be concluded from the previous result.
In fact, we know that when encoding, each byte is ’formed by only 6 bits’. Therefore, we have that
22*8/6= 30 bytes.
Ciphertext
Using the same logic used above, we have that the ciphertext is 112 bytes long.
Decrypted text
Using the same logic used above, we have that the decrypted text is 84 bytes long. This result can be
obtained either using the function length() or by doing some calculations. In fact, 112*6/8= 84 bytes.
1
University of Ljubljana, Faculty of Electrical Engineering Koldo Eizmendi Gallastegui
Laboratory of Imaging Technologies
Biomedical informatics 2018/2019
Question 4
This question asks to write some arguments about the reason why Base64 scheme is used when
encoding.
Base64 schemes basically represent binary data in an ASCII string format by translating it into a
base64 representation. This means that all kind of characters can be mapped in a reable and
printable alphabet (a-z, A-Z, 0-9).
If a message is send in binary, the transmission can be considered as composed by 8bit characters, so
it is base256: each byte is a symbol from 0 to 255. This has one main problem: as some characterrs
have special meaning this coding cannot safely be attached to some channels. Therefore, instead of
using 8 bit digits, Base64 uses 6 bit words, having 64 possible combinations. These way, the ASCII
characters used are perfectly compatible with any channel.
Question 5
2
University of Ljubljana, Faculty of Electrical Engineering Koldo Eizmendi Gallastegui
Laboratory of Imaging Technologies
Biomedical informatics 2018/2019
--------------------------------------------------------------------------------------------------------------------------------------
function [oKey,oText]=decrypt_text(iText)
letters = 'a':'z';
for i=1:length(letters)
for j=1:length(letters)
for k=1:length(letters)
Key(1)=letters(i);Key(2)=letters(j);Key(3)=letters(k);
oText=decryptText(iText,Key); % this function is the one coded
% in the lab
aux=strfind(oText,'John');
if aux~=0
break
end
end
if aux~=0
break
end
end
if aux~=0
break
end
end
oKey=Key;
end