WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
Hard Drive Recovery
Wiring your own LAN
 
Forum
Pages (3) [1] 2 3   ( Go to first unread post )

byte encoding to base 64

Wessol
Quote Post


Member
**

Group: Members
Posts: 32
Member No.: 51593
Joined: 16-May 12


heyz

is it possible to encode a array of bytes into base 64 ascii string, in masm?

i read about the CryptBinaryToString win32api but after execute the buffer is empty.
can anybody help me ?

CODE


includelib Crypt32.lib
include Crypt32.inc

.data
myArray db 0Ch, 0Ch, 0Ch, 0Fh, 0Ah

.data?
myBuffer dd 20 dup(?); large enough
tcharBuf dd 20 dup (?)

.code
invoke lstrlen, offset myArray
invoke CryptBinaryToString, Addr myArray, eax, CRYPT_STRING_BASE64, Addr myBuffer, Addr tcharBuf

Sponsored Links
PMEmail Poster
Top
huntingspace
Quote Post


Active Member
***

Group: Members
Posts: 49
Member No.: 49504
Joined: 11-February 12


try this:
CODE

includelib Crypt32.lib
include Crypt32.inc

CRYPT_STRING_NOCRLF equ 40000000h

.data
myArray db 0Ch, 0Ch, 0Ch, 0Fh, 0Ah
myBuffer dd 20 dup(0); large enough
tcharBuf dd $-myBuffer

.code
invoke CryptBinaryToString, Addr myArray, sizeof myArray,CRYPT_STRING_BASE64+CRYPT_STRING_NOCRLF, Addr myBuffer, Addr tcharBuf
PMEmail Poster
Top
Wessol
Quote Post


Member
**

Group: Members
Posts: 32
Member No.: 51593
Joined: 16-May 12


gracias sir it seems like its working cheers.gif

do you know how to swap a whole dword?

example

eax = 12345678
eax should be reversed to = 87654321

any thing to solve this?
PMEmail Poster
Top
Slider
Quote Post


Extremely Active Member
******

Group: Moderators
Posts: 313
Member No.: 5004
Joined: 11-May 07


BSWAP - Byte Swap

Code Mnemonic Description
0F C8+ rd BSWAP r32 Reverses the byte order of a 32-bit register.

Description
Reverses the byte order of a 32-bit (destination) register: bits 0 through 7 are swapped with bits 24 through 31, and bits 8 through 15 are swapped with bits 16 through 23. This instruction is provided for converting little-endian values to big-endian format and vice versa.
PMEmail Poster
Top
Wessol
Quote Post


Member
**

Group: Members
Posts: 32
Member No.: 51593
Joined: 16-May 12


thx slider but bwap swap only byte per byte is there a function that swap a whole dword at onnce?
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Pages (3) [1] 2 3  Reply to this topicStart new topicStart Poll

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian