Write a program that reads and encrypts a text file Encrypti
Solution
Encryption refers to the process of protecting data. Encryption is the transformation of intelligible data (plaintext) into an unintelligible form (ciphertext) by means of a mathematical process. The ciphertext is translated back to plaintext when the appropriate key that is necessary for decrypting (unlocking) the ciphertext is applied. There are two primary forms of encryption:
Read input from text file:
Set x=WScript.CreateObject(“WScript.shell”)
entxtde=inputbox(“Enter text to be encoded”)
entxtde=StrReverse(entxtde)
x.Run “%windir%\ otepad”
wscript.sleep 1000
x.sendkeys encode(entxtde)
function encode(s)
For i=1 To Len(s)
newtxt=Mid(s,I,1)
newtxt=Chr(Asc(newtxt)+3)
coded=coded & newtxt
Next
encode=coded
End Function
Encrypts the array of strings:
var key=”0c9abc43b129a5a0c598b4752dAAAAAA”;
var iv=”655f42836f84b716e6e99cc982AAAAAA”;
var original_Text=”This is some text”;
var encrypted_Text=original_Text.encrypt_AES(key,iv);
var decrypted_Text=encrypted_Text.decrypt_AES(key,iv);
return @
original_Text:{0}
encrypted_TextL1)
decrypted_TextL2)*.format(original_Text,encrypted_Text.hexString(),decrypted_Text)
.trim();
Encrypted data to output file:
data grades(encrypt=aes encryptkey=ilovedata);
length Student $ 9;
input Student $ StudentNumber section $
Test1 Test2 Final @ @;
format studentnumber z4.;
datalines;

