Question: Need help completing an encryption algorithmn for assembly. Project Detail The encryption is Adobe type 1 font encryption algorithm encryption this can be seen on
Need help completing an encryption algorithmn for assembly.
Project Detail
The encryption is Adobe type 1 font encryption algorithm encryption this can be seen on pages 61 to 65 on the pdf file https://www-cdf.fnal.gov/offline/PostScript/T1_SPEC.PDF
I'm using MASM32.
So heres my code so far.
.model tiny .data
filename db "file.txt", 0 bufferSize = 512 filehandle dw ? buffer db bufferSize dup (0)
r dw ? c1 dw 52845 c2 dw 22719 cipher db ?
message1 db 'Error opening the file. $' message2 db 'Error reading the file. $' message3 db 'Error closing the file. $'
.code org 100h
start:
call openfile call readfile call closefile call Exit
;the procedures
open: mov ah,3DH mov al,0 mov dx, offset filename int 21h jc openErr mov filehandle, ax ret
readfile: ;reads the file mov ah, 3Fh mov bx, filehandle mov cx, bufferSize mov dx, offset buffer int 21h cmp ax,0 jc readErr
;displays content of file call clear mov ah, 9 mov dx, offset buffer int 21h ret
closefile: mov ah, 3Eh mov bx, filehandle int 21h jc closeErr ret
;encrypt: ;need help with this
;decrypt: ;need help with this
clear: ;clears the screen mov ax,003h int 10h ret Exit: mov ax, 4C00h int 21h
newline: ;prints a newline mov ah, 2 mov dl, 0DH int 21h mov dl, 0AH int 21h ret
;error messages
openErr : call newline lea DX,message1 ;set up pointer to error message mov AH,9 ;display string function int 21H ;DOS call stc ;set error flag ret
readErr : call newline lea DX,message2 ;set up pointer to error message mov AH,9 ;display string function int 21H ;DOS call stc ;set error flag ret
closeErr : call newline lea DX,message3 ;set up pointer to error message mov AH,9 ;display string function int 21H ;DOS call stc ;set error flag ret
end start
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
