0 оценок0% нашли этот документ полезным (0 голосов)
343 просмотров19 страниц
This document describes an assembly language program for encrypting and decrypting text files. It includes:
1) An algorithm written in 8086 assembly that encrypts files up to 1MB by adding a 5 character key provided by the user to each character.
2) The program asks the user to select encrypting or decrypting files, then prompts them to enter a file name and the 5 character encryption key.
3) It then opens the file, performs the encryption or decryption by adding or subtracting the key value from each character, writes the results to a new file, and notifies the user the process completed successfully.
This document describes an assembly language program for encrypting and decrypting text files. It includes:
1) An algorithm written in 8086 assembly that encrypts files up to 1MB by adding a 5 character key provided by the user to each character.
2) The program asks the user to select encrypting or decrypting files, then prompts them to enter a file name and the 5 character encryption key.
3) It then opens the file, performs the encryption or decryption by adding or subtracting the key value from each character, writes the results to a new file, and notifies the user the process completed successfully.
This document describes an assembly language program for encrypting and decrypting text files. It includes:
1) An algorithm written in 8086 assembly that encrypts files up to 1MB by adding a 5 character key provided by the user to each character.
2) The program asks the user to select encrypting or decrypting files, then prompts them to enter a file name and the 5 character encryption key.
3) It then opens the file, performs the encryption or decryption by adding or subtracting the key value from each character, writes the results to a new file, and notifies the user the process completed successfully.
Title: Encryption of text files in assembly Student Eduardo Gonzalez Ortiz Group 3602
Approach Privacy in the handling of files containing information of importance to some people today has become a necessity to maintaining that inaccessible information to third parties that could give misuse, for that reason people have the ability to using tools developed techniques called "Techniques encryption" which are processes to become unreadable information with the application of mathematical algorithms designed by a programmer, this algorithm is applied inversely to information for later decryption. Target Create an algorithm using assembly language (assembler 8086) for encrypting distinct files (. Text files, images, etc.) with no larger than 1 Mb because the process will be slow and take a few minutes inclusive hours, the algorithm requested 5 characters (numeric or only letters) to the user to carry out the encryption of data, such data will be appended to the beginning of the file to perform the decryption. Justification Give the user a tool that allows you to keep important information inaccessible to persons considered unsuitable, giving the user the ability to have a custom encryption key (to apply the 5 characters), which is a great advantage since only tool user know the data that have been employed for encryption and giving a greater degree of security which is almost impossible to know another.
1.1 What is encrypted? This is a security measure that is used for storing or transferring sensitive information that should not be accessible to third parties. They can be passwords, nos. credit card, private conversations, etc.. To encrypt information and complex mathematical formulas are used to decrypt, use as a key parameter for these formulas. The plaintext is called encryption or encryption cipher. (Alegsa, s.f.) 1.2 What is Assembler? The term assembler (assembler English) refers to a type of computer program that is responsible for translating a source file written in assembler language, an object file containing machine code directly executable by the microprocessor. (Wikipedia, s.f.) Types of assemblers Basic Assemblers. They are very low, and their task is basically to provide symbolic names to the different instructions, parameters and such things as modes. Modular 32-bit or high-level assemblers. Assemblers are appeared in response to a new architecture for 32-bit processors, many of them having backward compatibility with programs can work with 16-bit structures. In addition to performing the same task as the previous ones, also allowing the use of macros, allow use structures typical of high-level languages more complex programming.
1.3 Tools Emu8086 EMU8086 - MICROPROCESSOR EMULATOR is a Shareware software in Development category developed by emu8086 (Intel 8086). Free DFD 1.1 Free DFD 1.1 is a program for creating flowcharts, that can be used to graphically represent a wide range of algorithms, run and debug if errors are found. (BlogSpot, 2013) 1.4 Diagramming Fig. 1.1
Development 2.1 Code inicio: MOV AH,06 MOV BH,1Fh ;FONDO AZUL TEXTO BLANCO MOV CX,0000 ;INICIO REN,COL MOV DX,6080 ;FIN REN,COL INT 10H mov bx,00h ;encriptar /desencriptar menu: mov dx,0205h mov ah,02h mov bh,00h int 10h mov dx,offset opc mov ah,09h int 21h mov ah,01h int 21h
cmp al,'1' je encriptar cmp al,'2' je desencriptar MOV AH,06 MOV BH,1Fh ;FONDO AZUL TEXTO BLANCO MOV CX,0000 ;INICIO REN,COL MOV DX,6080 ;FIN REN,COL INT 10H jmp menu encriptar: mov dx,offset datos mov ah,09h int 21h ;solicitud de caracteres leerCaracteres: mov ah,01h int 21h ;compara con enter para salir de la solicitud de cmp al,0dh je archivo
add bl,al ;and bl,0fh inc cont cmp cont,05h
je archivo jmp leerCaracteres archivo: mov si,00h ;mensaje para busqueda del archivo mov dx,offset msjnom mov ah,09h int 21h ;inicializacion del segemento de datos ;Abrir archivo por nombre desde teclado leer2: mov ax,0000 mov ah,01h int 21h cmp al,0dh je abrirArchivo mov tituloArchivo[di],al inc di loop leer2 abrirArchivo: mov dl,bl mov opr,bl mov al, 0 ;modo de accesopara abrir arhivo, modolectura/escritura mov dx, offset tituloArchivo ;offset lugar de memoria donde esta lavariable mov ah, 3dh ;se intenta abrir el archivo int 21h jc error ; si se prendio la bandera c ir a error mov handle, ax ;si no paso mover a lo que le dio el SO jmp leer error: ;leer archivo leer: mov bx, handle mov cx, 1 mov dx, offset leido mov ah, 3fh int 21h cmp ax, 0 ;ax queda en 0 cuando llega a EOF jz FIN ;si es 0 entonces va a fin para cerrar archivo mov dl,leido[0] add dl,opr ;mueve a vec los datos leidos del archivo mov vec[si],dl inc si ;mov ah,02h ;int 21h
jmp leer FIN: ;cerramos archivo ;mov bx, handle mov ah, 3eh int 21h ;ret ;crear nuevo archivo mov dx,offset msjnom2 mov ah,09h int 21h mov di,00h leerTituloArchivoACrear: mov ax,0000 mov ah,01h int 21h cmp al,0dh je crearArchivoE mov vtext[di],al inc di jmp leerTituloArchivoACrear crearArchivoE: mov ah,3Ch mov cx,00h mov dx,offset vtext int 21h jc salir ;si no se pudo crear mov dx,offset msjcreado ;nombre del mensaje mov ah,09 ; mov ah,09 sirve para presentar el msj en pantalla int 21h ;interrupcion de video mov bx,ax mov ah,3eh ;cierra el archivo int 21h ;abrir el archivo apenas creado editar: ;abrir mov ah,3dh mov al,1h mov dx,offset vtext int 21h jc salir ;Si hubo error ;Escritura de archivo mov bx,ax ; mover hadfile mov cx,si ;num de caracteres a grabar mov dx,offset vec mov ah,40h int 21h mov dx,offset msjcreado2 ;nombre del mensaje mov ah,09 ; mov ah,09 sirve para presentar el msj en pantalla
int 21h ;interrupcion de video cmp cx,ax jne salir ;error salir mov ah,3eh ;Cierre de archivo int 21h desencriptar: mov dx,offset datos mov ah,09h int 21h
;solicitud de caracteres leerCaracteresD: mov ah,01h int 21h ;compara con enter para salir de la solicitud de cmp al,0dh je archivoD add bl,al ;and bl,0fh inc cont cmp cont,05h je archivoD jmp leerCaracteresD archivoD: mov si,00h ;mensaje para busqueda del archivo mov dx,offset msjnom3 mov ah,09h int 21h ;inicializacion del segemento de datos ;Abrir archivo por nombre desde teclado
leer2D: mov ax,0000 mov ah,01h int 21h cmp al,0dh je abrirArchivoD mov tituloArchivo[di],al inc di loop leer2D abrirArchivoD: mov dl,bl mov opr,bl mov al, 0 ;modo de accesopara abrir arhivo, modolectura/escritura mov dx, offset tituloArchivo ;offset lugar de memoria donde esta lavariable mov ah, 3dh ;se intenta abrir el archivo int 21h
jc errorD ; si se prendio la bandera c ir a error mov handle, ax ;si no paso mover a lo que le dio el SO jmp leerD errorD: ;leer archivo leerD: mov bx, handle mov cx, 1 mov dx, offset leido mov ah, 3fh int 21h cmp ax, 0 ;ax queda en 0 cuando llega a EOF jz FIND ;si es 0 entonces va a fin para cerrar archivo mov dl,leido[0] sub dl,opr ;mueve a vec los datos leidos del archivo mov vec[si],dl inc si ;mov ah,02h ;int 21h jmp leerD FIND: ;cerramos archivo ;mov bx, handle mov ah, 3eh int 21h ;ret ;crear nuevo archivo mov dx,offset msjnom2 mov ah,09h int 21h mov di,00h leerTituloArchivoACrearD: mov ax,0000 mov ah,01h int 21h cmp al,0dh je crearArchivoD mov vtext[di],al inc di jmp leerTituloArchivoACrearD crearArchivoD: mov ah,3Ch mov cx,00h mov dx,offset vtext int 21h jc salir ;si no se pudo crear
mov dx,offset msjcreado ;nombre del mensaje mov ah,09 ; mov ah,09 sirve para presentar el msj en pantalla int 21h ;interrupcion de video
mov bx,ax mov ah,3eh ;cierra el archivo int 21h
;abrir el archivo apenas creado editarD: ;abrir mov ah,3dh mov al,1h mov dx,offset vtext int 21h jc salir ;Si hubo error ;Escritura de archivo mov bx,ax ; mover hadfile mov cx,si ;num de caracteres a grabar mov dx,offset vec mov ah,40h int 21h mov dx,offset msjcreado3 ;nombre del mensaje mov ah,09 ; mov ah,09 sirve para presentar el msj en pantalla int 21h ;interrupcion de video
cmp cx,ax jne salir ;error salir mov ah,3eh ;Cierre de archivo int 21h salir: mov ah,04ch int 21h leido db "$" handle dw ? ;identificadordel arhivo aux db "$" cont db 0 datos db 13,10,"Ingresa los valores para encriptar el archivo: $",13,10 opr db ? vtext db 100 dup('',0) tituloArchivo db 100 dup('',0) opc db 13,10,"1.-Encriptar 2.- Desencriptar $",13,10 msjnom db 0ah,0dh, 'Nombre del archivo a encriptar: ', '$' msjnom3 db 0ah,0dh, 'Nombre del archivo a desencriptar: ', '$' msjnom2 db 0ah,0dh, 'Nombre del nuevo archivo: ', '$'
msjcreado db 0ah,0dh, 'Archivo creado con exito', '$' msjcreado2 db 0ah,0dh, 'Archivo encriptado con exito', '$' msjcreado3 db 0ah,0dh, 'Archivo desencriptado con exito', '$' vec db 50 dup('')
2.2 Results 1.-The file to encrypt is in C:\emu8086\MyBuild (Fig. 2.1) with name 1.txt
Fig. 2.1
2.-When we run the program in emu8086we see the window how show the picture 2.2.First we going to select the number one.
Fig. 2.2 3.-The program request the values for encrypt the file, we need provide between one to five values for continues with the encrypt, after provide the values we going to provide the file name to encrypt (Fig. 2.3).
Fig. 2.3 4.-Provide the file name and we key press enter to continue (Fig. 2.4), while the program encrypt the file we wait a few minutes depend the size file until the program sho the message Nombre del nuevo archivo(Fig. 2.5)
Fig. 2.4
Fig. 2.5
5.-Provide the new File name(Fig.2.6), and key press enter to continue.The program finished when we see the messages Archivo creado con exito and Archivo encriptado con exito(Fig. 2.7) Fig. 2.6
Fig. 2.7
6.-We going to check in C:\emu8086\MyBuild to see our new encrypted file, and we see the new file how that show in the picture (Fig. 2.8).
Fig. 2.8
7.-To Decrypt the file is the same process the only change is when the program request a selection we going to key press 2 (Fig. 2.9). Fig. 2.9
Results of decrypt process (Fig. 2.10, Fig. 2.11): Fig. 2.10
Fig. 2.11
Conclusions The program can encrypt and decrypt any file but it is take a few minutes inclusive hours depend the file size but the results was the planned. The only disadvantage is that the user need know exactly the password to decrypt the file.
Bibliographies: Alegsa. (s.f.). Alegsa. Recuperado el 18 de 07 de 2014, de http://www.alegsa.com.ar/Dic/encriptacion.php Beekman, G. (2005). Introduccion a la informatica. Madrid: Pearson Educacion, S.A. BlogSpot. (01 de 2013). BlogSpot. Recuperado el 18 de 07 de 2014, de http://diagramas-de- flujo.blogspot.mx/2013/01/programa-realizar-diagramas-flujo.html electronicautil, B. (08 de 2008). Electronica util. Recuperado el 18 de 07 de 2014, de http://electronicautil.blogspot.mx/2008/08/emu8086-v-405.html http://es.wikipedia.org/wiki/Ensamblador
Bookmarks The Intel 8086 and Intel 8088 (i8086, officially called iAPX 86, and i8088) are two 16-bit microprocessors designed by Intel in 1978, initiators of the x86 architecture. The difference between the i8086 and i8088 is that the latter uses an 8-bit external bus, circuits used to support less expensive microprocessor, as opposed to 16-bit bus i8086. " (electronicautil, 2008)
Schedule No. Activity Date June July 27 28 29 30 1 2 3 4 5 6 7 8 9 10 11 1 Createtitle
2 Target 3 Justification 4 Approach 5 Search the topic and understand the topic 6 Create DFD 7 Codification and test 8 Resultevaluation 9 Createteoricalframework 10 Project presentation
Python Programming Reference Guide: A Comprehensive Guide for Beginners to Master the Basics of Python Programming Language with Practical Coding & Learning Tips