flat assembler
Message board for the users of flat assembler.

Index > Windows > ENCRYPT/DECRYPT jpg file online

Author
Thread Post new topic Reply to topic
SC0U7



Joined: 20 Feb 2018
Posts: 23
SC0U7 12 Jul 2019, 16:31
Hello flatassamblers Rolling Eyes
Im making a image encoder/decoder app with ASM.First i must write how it works:
1.I use wininet for READING a .JPG or .BMP or .ANYTHING from example.com/IMAGE.ANYTHING and store it inside variable cwhich work perfect but what i need and i failing since last week is use AES for encrypt that image and decrypt it from my FASM program ---example/IMG.BMP--*read bytes*--- then decrypt that bytes.Can someone help me With encoding and decoding ? Here is AES which work perfect with static string

Code:
format PE CONSOLE 4.0
entry start

include 'INCLUDE/win32a.inc'
include 'aes/aes.inc'

TEXTSIZE equ 3*BLOCK_SIZE

section '.text' code readable executable

  start:
   ; stdcall encAES, TEXTSIZE, clear_msg, enc_msg, key128
   ; stdcall decAES, TEXTSIZE, enc_msg, dec_msg, key128

    ;stdcall encAES, TEXTSIZE, clear_msg, enc_msg, key192
    ;stdcall decAES, TEXTSIZE, enc_msg, dec_msg, key192

    stdcall encAES, TEXTSIZE, clear_msg, enc_msg, key256
    ;stdcall decAES, TEXTSIZE, enc_msg, dec_msg, key256
     push enc_msg
     call [printf]

    invoke getchar
    invoke ExitProcess, 0

include 'aes/aes.asm'

section '.data' data readable writeable

  clear_msg db 'hello world',\
               0x0d, 0x0a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  enc_msg   rb TEXTSIZE
  dec_msg   rb TEXTSIZE

  key128    db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04,\
               0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
  key192    db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04,\
               0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c,\
               0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04
  key256    db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04,\
               0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c,\
               0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04,\
               0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c

section '.idata' import data readable writeable

  library kernel,'KERNEL32.DLL',\
          msvcrt,'MSVCRT'

  import kernel,\
         ExitProcess,'ExitProcess'

  import msvcrt,\
         printf,'printf',\
         getchar,'_fgetchar'      


How to i can use this for encrypt my variable readBytes dd ? and save it on disk as binary file encoded.anything and how to i can decrypt readBytes dd ? ? Or simplz written how i can use this AES on dd variable not db? thx pleas i need help[/b]
Post 12 Jul 2019, 16:31
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.