emergent;help i a project in encryption any text of alphapets and numbers into a random characters(from A-Z and 0-9 numbers)
using assembly
if u please

Recommended Answers

All 5 Replies

encryption any text of alphapets and numbers into a random characters

; do you want later to decrypt it back or no?

yes encryption and decryption code
and reading the text from a text file
thanks

Start simple - write a program which just copies the file, one character at a time.

Until you can do that reliably, there's no point trying to implement a crypt/decrypt, because you'll have no way to test it.

; here is a simple encrypting/decrypting app.:
; on encryption it will just inc hex values represented byeach char
; on decryption dec

.386
	.model flat,stdcall
	option casemap:none
	include \masm32\include\windows.inc
	include \masm32\include\user32.inc
	include \masm32\include\kernel32.inc
	include \masm32\include\masm32.inc
	includelib \masm32\lib\user32.lib
	includelib \masm32\lib\kernel32.lib
	includelib \masm32\lib\masm32.lib

.data?
	szBuff				db  256 dup(?)
.code
start:
invoke AllocConsole
invoke StdIn, ADDR szBuff, sizeof szBuff

lblCrypt:
mov eax, offset szBuff
@@:
cmp byte ptr [eax],0
je lblPrint
inc byte ptr [eax]
inc eax
jmp @B

lblPrint:
mov eax, offset szBuff
invoke	StdOut, ADDR szBuff

lblDecrypt:
mov eax, offset szBuff
@@:
cmp byte ptr [eax],0
je lblExit
dec byte ptr [eax]
inc eax
jmp @B

lblExit:
mov eax, offset szBuff
invoke	StdOut, ADDR szBuff
invoke	ExitProcess, 0
end start

thanks a lot .but it is only allowed for me to use TASM for 8086 ,and u here used MASM ,it is a little bit different could u help me to do this
thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.