Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MD5 hash of the clipboard (image on screen)
#1
Hi,

Is it possible to calculate MD5 hash of the clipboard not using files? (Better performance and better disk lifetime)

Macro MacroMD5
Code:
Copy      Help
rep 10000
,CaptureImageOnScreen(ScrWin[j].left ScrWin[j].top width height FileName)
,str md5.getfile(FileName)
,md5.encrypt(10) ;; size < 10 MB
,for i 1 100
,,if md5 = Hash[i]

Something like:

Macro MacroMD5
Code:
Copy      Help
rep 10000
,CaptureImageOnScreen(ScrWin[j].left ScrWin[j].top width height "") ;;Captures an image on the screen and stores to the clipboard
,str md5.ClipBoardMD5()
,for i 1 100
,,if md5 = Hash[i]
#2
All in single function.

Member function str.ScreenRectMD5
Code:
Copy      Help
function! RECT&r

;Calculates MD5 of pixels in specified rectangle on screen, and stores into this str variable as hex string.
;Returns 1 if successful, 0 if fails.

;EXAMPLE
;RECT r
;r.left=10; r.top=10; r.right=100; r.bottom=100
;str md5
;md5.ScreenRectMD5(r)
;out md5


;copy the rectangle from screen to memory dc
int wid(r.right-r.left) hei(r.bottom-r.top)
int dc=GetDC(0)
__MemBmp mb.Create(wid hei dc r.left r.top)
ReleaseDC 0 dc

;get pixel colors
_s.all(wid*hei*4 2)
BITMAPINFOHEADER h.biSize=sizeof(h)
h.biBitCount=32; h.biWidth=wid; h.biHeight=-hei; h.biPlanes=1
if(GetDIBits(mb.dc mb.bm 0 hei _s +&h DIB_RGB_COLORS)!=hei) ret

;md5
this.encrypt(10 _s)
ret 1
#3
Thanks for your rapid response.


Forum Jump:


Users browsing this thread: 1 Guest(s)