This algo only deals with non signed numbers.
;first approach
;"1234" == 1*10^3 + 2*10^2 + 3*10^1 + 4*10^0 == 1000+200+30+4
mov eax,"1234" ;30303030h to 39393939h
xor eax,"0000" ;sub "0000"
xor ecx,ecx
xor edx,edx
xor ebx,ebx
shld ecx,eax,8 ;"1"
shl eax,8 ;"234"
lea ebx,[ecx*8] ;1*8=8
lea ebx,[ebx+ecx*2] ;8+(1*2)=10
xor ecx,ecx
shld ecx,eax,8 ;"2"
shl eax,8 ;"34"
add ebx,ecx ;10+2=12
lea edx,[ebx*8] ;12*8=96
lea edx,[edx+ebx*2] ;96+(12*2)=120
xor ecx,ecx
xor ebx,ebx
shld ecx,eax,8 ;"3"
shl eax,8 ;"4"
add edx,ecx ;120+3=123
lea ebx,[edx*8] ;123*8=984
lea ebx,[ebx+edx*2] ;984+(123*2)=1230
xor ecx,ecx
shld ecx,eax,8 ;"4"
add ebx,ecx ;1230+4=1234
;ebx="1234" converted to binary equals to 4d2h
You can create a lookup table with all possible combinations from 0000 to 9999 instead of do calculus of each number each time. Will have a execution time gain in 1 million attempts.