PowerBuilder Generate MD5 / Check File MD5
Generate MD5 Method 1
Declare External Functions
1 2 3 4 5 6 7 8 |
Function Boolean CryptAcquireContextA (Ref ULong hProv, Ref String pszContainer, Ref String pszProvider, ULong dwProvType, ULong dwFlags) Library "advapi32.dll" Function Boolean CryptReleaseContext (ULong hProv, ULong dwFlags) Library "advapi32.dll" Function Boolean CryptCreateHash (ULong hProv, UInt Algid, ULong hKey, ULong dwFlags, Ref ULong phHash) Library "advapi32.dll" Function Boolean CryptHashData (ULong hHash, Ref String pbData, ULong dwDataLen, ULong dwFlags) Library "advapi32.dll" Function Boolean CryptHashData (ULong hHash, Ref Blob pbData, ULong dwDataLen, ULong dwFlags) Library "advapi32.dll" Function Boolean CryptDestroyHash (ULong hHash) Library "advapi32.dll" Function Boolean CryptGetHashParam (ULong hHash, ULong dwParam, Ref Blob pbData, Ref ULong pdwDataLen, ULong dwFlags) Library "advapi32.dll" Function ULong GetLastError () Library "kernel32.dll" |
Instance Variable
1 2 3 4 |
Constant ULong PROV_RSA_FULL = 1 Constant ULong CRYPT_VERIFYCONTEXT = 4026531840 // 0xF0000000 Constant ULong CALG_MD5 = 32771 // 4<<13 | 0 | 3 Constant ULong HP_HASHVAL = 2 // 0x0002 |
Generate MD5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
//==================================================================== // Function: nvo_md5.of_md5() //-------------------------------------------------------------------- // Description: Calculate the MD5 message digest hash of a string Using the Windows Crypto API ( PB 10 later) //-------------------------------------------------------------------- // Arguments: // value blob abl_text //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.of_md5 ( blob abl_text ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== ULong MD5LEN = 16 ULong hProv // provider handle ULong hHash // hash object handle ULong err_number String ls_result, ls_null Integer i, l, r, b Blob{16} bl_hash Blob{1} bl_byte SetNull (ls_null) ULong cbHash = 0 Char HexDigits[0 To 15] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'} //Get handle to the crypto provider If Not CryptAcquireContextA(hProv, ls_null, ls_null, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT) Then err_number = GetLastError() Return 'acquire context failed ' + String (err_number) End If // Create the hash object If Not CryptCreateHash(hProv, CALG_MD5, 0, 0, hHash) Then err_number = GetLastError() CryptReleaseContext(hProv, 0) Return 'create hash failed ' + String (err_number) End If // Add the input to the hash If Not CryptHashData(hHash, abl_text, Len(abl_text), 0) Then err_number = GetLastError() CryptDestroyHash(hHash) CryptReleaseContext(hProv, 0) Return 'hashdata failed ' + String (err_number) End If // Get the hash value and convert it to readable characters cbHash = MD5LEN If (CryptGetHashParam(hHash, HP_HASHVAL, bl_hash, cbHash, 0)) Then For i = 1 To 16 bl_byte = BlobMid (bl_hash, i, 1) b = AscA(String(bl_byte,EncodingANSI!)) r = Mod (b, 16) // right 4 bits l = b / 16 // left 4 bits ls_result += HexDigits [l] + HexDigits [r] Next Else err_number = GetLastError() Return 'gethashparam failed ' + String (err_number) End If // clean up and return CryptDestroyHash(hHash) CryptReleaseContext(hProv, 0) Return ls_result |
Generate MD5 Method 2
Declare External Functions
1 2 3 4 |
Subroutine MD5Init (Ref md5_ctx lpContext) Library "cryptdll.dll" Alias For "MD5Init;ansi" Subroutine MD5Final (Ref md5_ctx lpContext) Library "cryptdll.dll" Alias For "MD5Final;ansi" Subroutine MD5Update (Ref md5_ctx lpContext, ULong lpBuffer, ULong BufSize) Library "cryptdll.dll" Alias For "MD5Update;ansi" Subroutine MD5Update (Ref md5_ctx lpContext, Blob lpBuffer, ULong BufSize) Library "cryptdll.dll" Alias For "MD5Update;ansi" |
md5_ctx from structure
1 2 3 4 5 6 |
type md5_ctx from structure byte a [8] byte b [16] byte c [64] byte d [16] end type |
Function: nvo_md5.decto()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
//==================================================================== // Function: nvo_md5.decto() //-------------------------------------------------------------------- // Description: NextEnd //-------------------------------------------------------------------- // Arguments: // value decimal ad_dec // readonly unsignedinteger aui_sys //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.decto ( decimal ad_dec, readonly unsignedinteger aui_sys ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== String ls_ret //Returned result String ls_dec String ls_left, ls_right, ls_mod UInt ld_mod/* The remainder is an integer */ Dec ld_mul //Take the product of decimals as dec Int i, li_pos, li_len, li_pointpos, li_maxpower, li_minpower If IsNull (ad_dec) Or IsNull (aui_sys) Or aui_sys < 2 Then Goto NextEnd ls_dec = String (ad_dec) li_pointpos = Pos (ls_dec, '.') If li_pointpos = 0 Then If ad_dec < aui_sys Then //greater than 10 decimal If ad_dec <= 9 Then ls_ret = String (ad_dec) Goto NextEnd ElseIf ad_dec > 9 And ad_dec < aui_sys Then ls_ret = Char (64-9 + ad_dec) //Numbers greater than 9 are converted to letters Goto NextEnd End If Else Do ld_mod = Mod (ad_dec, aui_sys) //take the remainder ls_mod = decto (ld_mod, aui_sys) ls_ret = ls_mod + ls_ret ad_dec = Long ((ad_dec - ld_mod)/aui_sys) //Go to the quotient Loop Until ad_dec < aui_sys If ad_dec > 9 Then ls_ret = Char (64-9 + ad_dec) + ls_ret Else ls_ret = String (ad_dec) + ls_ret End If End If Else ls_left = Mid (ls_dec, 1, li_pointpos) //take integer ls_right = Mid (ls_dec, li_pointpos) //decimal ls_ret = decto (Dec (ls_left), aui_sys) + '.' //integer part conversion ld_mul = Dec (ls_right) For i = 1 To 10 //Maximum accuracy is 10 ld_mul = ld_mul * aui_sys ls_ret = ls_ret + String (Int (ld_mul)) //round If ld_mul = Int (ld_mul) Then Exit //No remainder ld_mul = ld_mul - Int (ld_mul) //Remove integer Next End If NextEnd: Return ls_ret |
Function: nvo_md5.hexencode()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
//==================================================================== // Function: nvo_md5.hexencode() //-------------------------------------------------------------------- // Description: Convert characters to hexadecimal encoding //-------------------------------------------------------------------- // Arguments: // reference byte lb_array[] is the character to be converted // reference character lc_result[] encoding in the source character //-------------------------------------------------------------------- // Returns: integer hexadecimal encoding //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.hexencode ( ref byte lb_array[], ref character lc_result[] ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Long l_len, i, l_num Char lc_temp [2] l_len = UpperBound (lb_array []) For i = 1 To l_len l_num = (2 * i)-1 If lb_array [i] < 16 Then //If less than 16, add 0 lc_temp [1] = '0' lc_temp [2] = decto (lb_array [i], 16) Else lc_temp [] = decto (lb_array [i], 16) End If lc_result [l_num] = lc_temp [1] lc_result [l_num + 1] = lc_temp [2] Next Return l_len * 2 |
Function: nvo_md5.of_md5string()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
//==================================================================== // Function: nvo_md5.of_md5string() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // reference blob abl_string // reference string ls_result //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.of_md5string ( ref blob abl_string, ref string ls_result ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== ULong lul_size md5_ctx lpContext Char lc_result [] byte lbyte_result [] ls_result = '' lul_size = Len (abl_string) MD5Init (lpContext) MD5Update (lpContext, abl_string, lul_size) MD5Final (lpContext) lbyte_result [] = lpContext.b [] hexencode (lbyte_result [], lc_result []) ls_result = lc_result [] Return '' |
File MD5 Method 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
//==================================================================== // Function: nvo_md5.of_md5file_ole() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string as_filepath // value string as_hata // reference string as_md5 //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.of_md5file_ole ( string as_filepath, string as_hata, ref string as_md5 ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== OLEObject obj_md5, obj_stream, obj_dom, obj_element Integer li_rc, li_temp If IsNull( as_filepath ) Then as_hata = "File Path returned null!" Return -1 End If li_temp = 1 //Initial Value obj_md5 = Create OLEObject li_rc = obj_md5.ConnectToNewObject("System.Security.Cryptography.MD5CryptoServiceProvider") If li_rc = 0 Then //Success obj_stream = Create OLEObject li_rc = obj_stream.ConnectToNewObject("ADODB.Stream") Choose Case li_rc Case 0 obj_stream.Open obj_stream.Type = 1 obj_stream.LoadFromFile(as_filepath) obj_md5.ComputeHash_2(obj_stream.Read) obj_dom = Create OLEObject li_rc = obj_dom.ConnectToNewObject("Msxml2.DOMDocument.6.0") If li_rc = 0 Then obj_element = obj_dom.CreateElement("tmp") //Gecici Element Olusturma obj_element.DataType = "bin.hex" //Cevirme obj_element.NodeTypedValue = obj_md5.Hash as_md5 = obj_element.Text //Cevirilmis MD5 Degeri Alma Else li_temp = -1 as_hata = "Msxml2.DOMDocument.6.0 has received an error! li_rc : " + String(li_rc) End If obj_stream.Close Case Else li_temp = -1 as_hata = "ADODB.Stream has received an error! li_rc : " + String(li_rc) End Choose Else li_temp = -1 as_hata = "MD5CryptoServiceProvider has received an error! li_rc : " + String(li_rc) End If Destroy obj_dom Destroy obj_stream Destroy obj_md5 Return li_temp |
Example Source Code
nvo_md5 from nonvisualobject
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 |
forward global type nvo_md5 from nonvisualobject end type type md5_ctx from structure within nvo_md5 end type end forward type md5_ctx from structure byte a [8] byte b [16] byte c [64] byte d [16] end type shared variables end variables global type nvo_md5 from nonvisualobject autoinstantiate end type type prototypes //method 1 Function Long OpenProcess (Long dwDesiredAccess, Long bInheritHandle, Long dwProcessId) Library "kernel32.dll" Alias For "OpenProcess; ansi" Function Boolean CloseHandle (Long hObject) Library "kernel32" Alias For "CloseHandle; ansi" Function ULong CreateFile (Ref String lpFileName, ULong dwDesiredAccess, ULong dwShareMode, Ref ULong lpSecurityAttributes [3], ULong dwCreationDisposition, ULong dwFlagsAndAttributes, ULong hTemplateFile) Library "kernel32.dll" Alias For "CreateFileA; ansi" Function ULong CreateFileMapping (ULong hFile, ULong lpFileMappigAttributes[3], ULong flProtect, ULong dwMaximumSizeHigh, ULong dwMaximumSizeLow, Ref String lpName) Library "kernel32" Alias For "CreateFileMappingA; ansi" //Function ULong CreateFileMapping(ULong hFile,Ref SECURITY_ATTRIBUTES lpFileMappigAttributes,ULong flProtect,ULong dwMaximumSizeHigh,ULong dwMaximumSizeLow,Ref String lpName) Library "kernel32.dll" Alias For "CreateFileMappingA" Function ULong OpenFileMapping (ULong dwDesiredAccess, Boolean bInheritHandle, Ref String lpName) Library "kernel32" Alias For "OpenFileMappingA; ansi" Function ULong MapViewOfFile (ULong hFileMappingObject, ULong dwDesiredAccess, ULong dwFileOffsetHigh, ULong dwFileOffsetLow, ULong dwNumberOfBytesToMap) Library "kernel32" Alias For "MapViewOfFile" Subroutine UnmapViewOfFile (ULong lpBaseAddress) Library "kernel32" Alias For "UnmapViewOfFile; ansi" Subroutine MD5Init (Ref md5_ctx lpContext) Library "cryptdll.dll" Alias For "MD5Init;ansi" Subroutine MD5Final (Ref md5_ctx lpContext) Library "cryptdll.dll" Alias For "MD5Final;ansi" Subroutine MD5Update (Ref md5_ctx lpContext, ULong lpBuffer, ULong BufSize) Library "cryptdll.dll" Alias For "MD5Update;ansi" Subroutine MD5Update (Ref md5_ctx lpContext, Blob lpBuffer, ULong BufSize) Library "cryptdll.dll" Alias For "MD5Update;ansi" //method 2 Function Boolean CryptAcquireContextA (Ref ULong hProv, Ref String pszContainer, Ref String pszProvider, ULong dwProvType, ULong dwFlags) Library "advapi32.dll" Function Boolean CryptReleaseContext (ULong hProv, ULong dwFlags) Library "advapi32.dll" Function Boolean CryptCreateHash (ULong hProv, UInt Algid, ULong hKey, ULong dwFlags, Ref ULong phHash) Library "advapi32.dll" Function Boolean CryptHashData (ULong hHash, Ref String pbData, ULong dwDataLen, ULong dwFlags) Library "advapi32.dll" Function Boolean CryptHashData (ULong hHash, Ref Blob pbData, ULong dwDataLen, ULong dwFlags) Library "advapi32.dll" Function Boolean CryptDestroyHash (ULong hHash) Library "advapi32.dll" Function Boolean CryptGetHashParam (ULong hHash, ULong dwParam, Ref Blob pbData, Ref ULong pdwDataLen, ULong dwFlags) Library "advapi32.dll" Function ULong GetLastError () Library "kernel32.dll" end prototypes type variables Constant ULong GENERIC_READ = 2147483648 Constant ULong FILE_SHARE_READ = 1 Constant ULong OPEN_EXISTING = 3 Constant ULong FILE_ATTRIBUTE_NORMAL = 128 Constant ULong PAGE_READONLY = 2 Constant ULong FILE_MAP_READ = 4 Constant ULong PROV_RSA_FULL = 1 Constant ULong CRYPT_VERIFYCONTEXT = 4026531840 // 0xF0000000 Constant ULong CALG_MD5 = 32771 // 4<<13 | 0 | 3 Constant ULong HP_HASHVAL = 2 // 0x0002 end variables forward prototypes public function string decto (decimal ad_dec, readonly unsignedinteger aui_sys) public function integer hexencode (ref byte lb_array[], ref character lc_result[]) public function string of_md5_10before (string as_text) public function string of_md5 (string as_text) public function string of_md5 (blob abl_text) public function integer of_md5file_ole (string as_filepath, string as_hata, ref string as_md5) public function string of_md5file (ref string ls_filename, ref string ls_result) public function string of_md5string (ref string ls_string, ref string ls_result) public function string of_md5 (string as_text, encoding aencoding) public function string of_md5string (ref blob abl_string, ref string ls_result) public function string of_md5string (ref string ls_string, ref string ls_result, encoding aencoding) end prototypes public function string decto (decimal ad_dec, readonly unsignedinteger aui_sys);//==================================================================== // Function: nvo_md5.decto() //-------------------------------------------------------------------- // Description: NextEnd //-------------------------------------------------------------------- // Arguments: // value decimal ad_dec // readonly unsignedinteger aui_sys //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.decto ( decimal ad_dec, readonly unsignedinteger aui_sys ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== String ls_ret //Returned result String ls_dec String ls_left, ls_right, ls_mod UInt ld_mod/* The remainder is an integer */ Dec ld_mul //Take the product of decimals as dec Int i, li_pos, li_len, li_pointpos, li_maxpower, li_minpower If IsNull (ad_dec) Or IsNull (aui_sys) Or aui_sys < 2 Then Goto NextEnd ls_dec = String (ad_dec) li_pointpos = Pos (ls_dec, '.') If li_pointpos = 0 Then If ad_dec < aui_sys Then //greater than 10 decimal If ad_dec <= 9 Then ls_ret = String (ad_dec) Goto NextEnd ElseIf ad_dec > 9 And ad_dec < aui_sys Then ls_ret = Char (64-9 + ad_dec) //Numbers greater than 9 are converted to letters Goto NextEnd End If Else Do ld_mod = Mod (ad_dec, aui_sys) //take the remainder ls_mod = decto (ld_mod, aui_sys) ls_ret = ls_mod + ls_ret ad_dec = Long ((ad_dec - ld_mod)/aui_sys) //Go to the quotient Loop Until ad_dec < aui_sys If ad_dec > 9 Then ls_ret = Char (64-9 + ad_dec) + ls_ret Else ls_ret = String (ad_dec) + ls_ret End If End If Else ls_left = Mid (ls_dec, 1, li_pointpos) //take integer ls_right = Mid (ls_dec, li_pointpos) //decimal ls_ret = decto (Dec (ls_left), aui_sys) + '.' //integer part conversion ld_mul = Dec (ls_right) For i = 1 To 10 //Maximum accuracy is 10 ld_mul = ld_mul * aui_sys ls_ret = ls_ret + String (Int (ld_mul)) //round If ld_mul = Int (ld_mul) Then Exit //No remainder ld_mul = ld_mul - Int (ld_mul) //Remove integer Next End If NextEnd: Return ls_ret end function public function integer hexencode (ref byte lb_array[], ref character lc_result[]);//==================================================================== // Function: nvo_md5.hexencode() //-------------------------------------------------------------------- // Description: Convert characters to hexadecimal encoding //-------------------------------------------------------------------- // Arguments: // reference byte lb_array[] is the character to be converted // reference character lc_result[] encoding in the source character //-------------------------------------------------------------------- // Returns: integer hexadecimal encoding //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.hexencode ( ref byte lb_array[], ref character lc_result[] ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Long l_len, i, l_num Char lc_temp [2] l_len = UpperBound (lb_array []) For i = 1 To l_len l_num = (2 * i)-1 If lb_array [i] < 16 Then //If less than 16, add 0 lc_temp [1] = '0' lc_temp [2] = decto (lb_array [i], 16) Else lc_temp [] = decto (lb_array [i], 16) End If lc_result [l_num] = lc_temp [1] lc_result [l_num + 1] = lc_temp [2] Next Return l_len * 2 end function public function string of_md5_10before (string as_text);//==================================================================== // Function: nvo_md5.of_md5_10before() //-------------------------------------------------------------------- // Description: Calculate the MD5 message digest hash of a string Using the Windows Crypto API // PB7/8/9 //-------------------------------------------------------------------- // Arguments: // value string as_text //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.of_md5_10before ( string as_text ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== ULong MD5LEN = 16 ULong hProv // provider handle ULong hHash // hash object handle ULong err_number String ls_result, ls_null Integer i, l, r, b Blob{16} bl_hash Blob{1} bl_byte SetNull (ls_null) ULong cbHash = 0 Char HexDigits[0 To 15] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'} //Get handle to the crypto provider If Not CryptAcquireContextA(hProv, ls_null, ls_null, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT) Then err_number = GetLastError() Return 'acquire context failed ' + String (err_number) End If // Create the hash object If Not CryptCreateHash(hProv, CALG_MD5, 0, 0, hHash) Then err_number = GetLastError() CryptReleaseContext(hProv, 0) Return 'create hash failed ' + String (err_number) End If // Add the input to the hash If Not CryptHashData(hHash, as_text, Len(as_text), 0) Then err_number = GetLastError() CryptDestroyHash(hHash) CryptReleaseContext(hProv, 0) Return 'hashdata failed ' + String (err_number) End If // Get the hash value and convert it to readable characters cbHash = MD5LEN If (CryptGetHashParam(hHash, HP_HASHVAL, bl_hash, cbHash, 0)) Then For i = 1 To 16 bl_byte = BlobMid (bl_hash, i, 1) b = Asc (String(bl_byte)) r = Mod (b, 16) // right 4 bits l = b / 16 // left 4 bits ls_result += HexDigits [l] + HexDigits [r] Next Else err_number = GetLastError() Return 'gethashparam failed ' + String (err_number) End If // clean up and return CryptDestroyHash(hHash) CryptReleaseContext(hProv, 0) Return ls_result end function public function string of_md5 (string as_text);//==================================================================== // Function: nvo_md5.of_md5() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string as_text //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.of_md5 ( string as_text ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Blob lbl_text lbl_text = Blob(as_text, EncodingUTF8!) Return of_md5(lbl_text) end function public function string of_md5 (blob abl_text);//==================================================================== // Function: nvo_md5.of_md5() //-------------------------------------------------------------------- // Description: Calculate the MD5 message digest hash of a string Using the Windows Crypto API ( PB 10 later) //-------------------------------------------------------------------- // Arguments: // value blob abl_text //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.of_md5 ( blob abl_text ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== ULong MD5LEN = 16 ULong hProv // provider handle ULong hHash // hash object handle ULong err_number String ls_result, ls_null Integer i, l, r, b Blob{16} bl_hash Blob{1} bl_byte SetNull (ls_null) ULong cbHash = 0 Char HexDigits[0 To 15] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'} //Get handle to the crypto provider If Not CryptAcquireContextA(hProv, ls_null, ls_null, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT) Then err_number = GetLastError() Return 'acquire context failed ' + String (err_number) End If // Create the hash object If Not CryptCreateHash(hProv, CALG_MD5, 0, 0, hHash) Then err_number = GetLastError() CryptReleaseContext(hProv, 0) Return 'create hash failed ' + String (err_number) End If // Add the input to the hash If Not CryptHashData(hHash, abl_text, Len(abl_text), 0) Then err_number = GetLastError() CryptDestroyHash(hHash) CryptReleaseContext(hProv, 0) Return 'hashdata failed ' + String (err_number) End If // Get the hash value and convert it to readable characters cbHash = MD5LEN If (CryptGetHashParam(hHash, HP_HASHVAL, bl_hash, cbHash, 0)) Then For i = 1 To 16 bl_byte = BlobMid (bl_hash, i, 1) b = AscA(String(bl_byte,EncodingANSI!)) r = Mod (b, 16) // right 4 bits l = b / 16 // left 4 bits ls_result += HexDigits [l] + HexDigits [r] Next Else err_number = GetLastError() Return 'gethashparam failed ' + String (err_number) End If // clean up and return CryptDestroyHash(hHash) CryptReleaseContext(hProv, 0) Return ls_result end function public function integer of_md5file_ole (string as_filepath, string as_hata, ref string as_md5);//==================================================================== // Function: nvo_md5.of_md5file_ole() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string as_filepath // value string as_hata // reference string as_md5 //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.of_md5file_ole ( string as_filepath, string as_hata, ref string as_md5 ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== OLEObject obj_md5, obj_stream, obj_dom, obj_element Integer li_rc, li_temp If IsNull( as_filepath ) Then as_hata = "File Path returned null!" Return -1 End If li_temp = 1 //Initial Value obj_md5 = Create OLEObject li_rc = obj_md5.ConnectToNewObject("System.Security.Cryptography.MD5CryptoServiceProvider") If li_rc = 0 Then //Success obj_stream = Create OLEObject li_rc = obj_stream.ConnectToNewObject("ADODB.Stream") Choose Case li_rc Case 0 obj_stream.Open obj_stream.Type = 1 obj_stream.LoadFromFile(as_filepath) obj_md5.ComputeHash_2(obj_stream.Read) obj_dom = Create OLEObject li_rc = obj_dom.ConnectToNewObject("Msxml2.DOMDocument.6.0") If li_rc = 0 Then obj_element = obj_dom.CreateElement("tmp") //Gecici Element Olusturma obj_element.DataType = "bin.hex" //Cevirme obj_element.NodeTypedValue = obj_md5.Hash as_md5 = obj_element.Text //Cevirilmis MD5 Degeri Alma Else li_temp = -1 as_hata = "Msxml2.DOMDocument.6.0 has received an error! li_rc : " + String(li_rc) End If obj_stream.Close Case Else li_temp = -1 as_hata = "ADODB.Stream has received an error! li_rc : " + String(li_rc) End Choose Else li_temp = -1 as_hata = "MD5CryptoServiceProvider has received an error! li_rc : " + String(li_rc) End If Destroy obj_dom Destroy obj_stream Destroy obj_md5 Return li_temp end function public function string of_md5file (ref string ls_filename, ref string ls_result);//==================================================================== // Function: nvo_md5.of_md5file() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // reference string ls_filename // reference string ls_result //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.of_md5file ( ref string ls_filename, ref string ls_result ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== ULong lul_size ULong lul_hfile, lul_hmap, lul_pAddr Long ll_ret ULong lul_Secu [3] md5_ctx lpContext Char lc_result [] byte lbyte_result [] String ls_ref, ls_errtext Boolean lb_ret ls_result = '' ls_filename = String (ls_filename, '') If DirectoryExists (ls_filename) = True Then ls_errtext = 'Cannot be a folder!' //+ string (ls_filename) + '~ r ~ n' Goto NextEnd End If If FileExists (ls_filename) = False Then ls_errtext = 'File does not exist!' //+ string (ls_filename) + '~ r ~ n' Goto NextEnd End If lul_size = FileLength (ls_filename) If lul_size = -1 Then ls_errtext = 'FileLength:' + String (lul_size) + '~ r ~ n' Goto NextEnd End If If lul_size = 0 Then ls_errtext = 'File content cannot be empty:' + String (lul_size) + '~ r ~ n' Goto NextEnd End If If lul_size > 2 * 645 * 1024 * 1024 Then //Maximum support ls_errtext = 'Max support:' + String (2 * 645 * 1024 * 1024, '###, ###, ## 0') + '~ r ~ n' Goto NextEnd End If Try lul_hfile = CreateFile (ls_filename, GENERIC_READ, FILE_SHARE_READ, lul_Secu [], OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) If lul_hfile <= 0 Then ls_errtext = 'CreateFile:' + String (lul_hfile) + '~ r ~ n' THROW Create runtimeerror End If lul_hmap = CreateFileMapping (lul_hfile, lul_Secu, PAGE_READONLY, 0, 0, ls_ref) If lul_hmap <= 0 Then ls_errtext = 'CreateFileMapping:' + String (lul_hmap) + '~ r ~ n' THROW Create runtimeerror End If lul_pAddr = MapViewOfFile (lul_hmap, FILE_MAP_READ, 0,0, lul_size); If lul_pAddr <= 0 Then ls_errtext = 'MapViewOfFile:' + String (lul_pAddr) + '~ r ~ n' THROW Create runtimeerror End If MD5Init (lpContext) MD5Update (lpContext, lul_pAddr, lul_size) MD5Final (lpContext) Catch (runtimeerror e) ls_errtext += e.getmessage () Finally If lul_pAddr > 0 Then UnmapViewOfFile (lul_pAddr); lul_pAddr = 0 End If If lul_hmap > 0 Then lb_ret = CloseHandle (lul_hmap) If lb_ret = False Then ls_errtext += 'CloseHandle:' + String (lb_ret) + '~ r ~ n' //goto e Else lul_hmap = 0 End If End If If lul_hfile > 0 Then lb_ret = CloseHandle (lul_hfile) If lb_ret = False Then ls_errtext += 'CloseHandle:' + String (lb_ret) + '~ r ~ n' //goto e Else lul_hfile = 0 End If End If End Try If ls_errtext <> '' Then Goto NextEnd lbyte_result [] = lpContext.b [] hexencode (lbyte_result [], lc_result []) ls_result = lc_result [] Return '' Goto NextEnd NextEnd: Return ls_errtext end function public function string of_md5string (ref string ls_string, ref string ls_result);//==================================================================== // Function: nvo_md5.of_md5string() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // reference string ls_string // reference string ls_result //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.of_md5string ( ref string ls_string, ref string ls_result ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Blob lblob_string lblob_string = Blob (ls_string, encodingutf8!) of_md5string (lblob_string, ls_result) Return '' end function public function string of_md5 (string as_text, encoding aencoding);//==================================================================== // Function: nvo_md5.of_md5() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string as_text // value Encoding aEncoding //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.of_md5 ( string as_text, encoding aencoding ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Blob lbl_text lbl_text = Blob(as_text, aEncoding) Return of_md5(lbl_text) end function public function string of_md5string (ref blob abl_string, ref string ls_result);//==================================================================== // Function: nvo_md5.of_md5string() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // reference blob abl_string // reference string ls_result //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.of_md5string ( ref blob abl_string, ref string ls_result ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== ULong lul_size md5_ctx lpContext Char lc_result [] byte lbyte_result [] ls_result = '' lul_size = Len (abl_string) MD5Init (lpContext) MD5Update (lpContext, abl_string, lul_size) MD5Final (lpContext) lbyte_result [] = lpContext.b [] hexencode (lbyte_result [], lc_result []) ls_result = lc_result [] Return '' end function public function string of_md5string (ref string ls_string, ref string ls_result, encoding aencoding);//==================================================================== // Function: nvo_md5.of_md5string() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // reference string ls_string // reference string ls_result // value encoding aencoding //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/09 //-------------------------------------------------------------------- // Usage: nvo_md5.of_md5string ( ref string ls_string, ref string ls_result, encoding aencoding ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Blob lblob_string lblob_string = Blob (ls_string, aencoding) of_md5string (lblob_string, ls_result) Return '' end function on nvo_md5.create call super::create TriggerEvent( this, "constructor" ) end on on nvo_md5.destroy TriggerEvent( this, "destructor" ) call super::destroy end on |
w_main from window
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
forward global type w_main from window end type type cb_filemd52 from commandbutton within w_main end type type st_4 from statictext within w_main end type type cb_filemd51 from commandbutton within w_main end type type mle_outfile from multilineedit within w_main end type type st_3 from statictext within w_main end type type st_2 from statictext within w_main end type type st_1 from statictext within w_main end type type ddlb_encoding from dropdownlistbox within w_main end type type mle_output from multilineedit within w_main end type type mle_input from multilineedit within w_main end type type cb_md52 from commandbutton within w_main end type type cb_md51 from commandbutton within w_main end type type gb_1 from groupbox within w_main end type type gb_2 from groupbox within w_main end type end forward global type w_main from window integer width = 2423 integer height = 1716 boolean titlebar = true string title = "PowerBuilder Generate MD5" boolean controlmenu = true boolean minbox = true boolean maxbox = true boolean resizable = true long backcolor = 67108864 string icon = "AppIcon!" boolean center = true cb_filemd52 cb_filemd52 st_4 st_4 cb_filemd51 cb_filemd51 mle_outfile mle_outfile st_3 st_3 st_2 st_2 st_1 st_1 ddlb_encoding ddlb_encoding mle_output mle_output mle_input mle_input cb_md52 cb_md52 cb_md51 cb_md51 gb_1 gb_1 gb_2 gb_2 end type global w_main w_main type prototypes Function Boolean CryptBinaryToString ( Blob pbBinary, ULong cbBinary, ULong dwFlags, Ref String pszString, Ref ULong pcchString ) Library "crypt32.dll" Alias For "CryptBinaryToStringW" Function Boolean CryptBinaryToString ( Blob pbBinary, ULong cbBinary, ULong dwFlags, Long pszString, Ref ULong pcchString ) Library "crypt32.dll" Alias For "CryptBinaryToStringW" Function Boolean CryptStringToBinary ( String pszString, ULong cchString, ULong dwFlags, Ref Blob pbBinary, Ref ULong pcbBinary, Ref ULong pdwSkip, Ref ULong pdwFlags ) Library "crypt32.dll" Alias For "CryptStringToBinaryW" end prototypes forward prototypes public function Encoding wf_getencoding () end prototypes public function Encoding wf_getencoding ();Encoding lEncoding lEncoding = EncodingANSI! //default If ddlb_encoding.Text = "EncodingANSI!" Then lEncoding = EncodingANSI! ElseIf ddlb_encoding.Text = "EncodingUTF8!" Then lEncoding = EncodingUTF8! ElseIf ddlb_encoding.Text = "EncodingUTF16LE!" Then lEncoding = EncodingUTF16LE! ElseIf ddlb_encoding.Text = "EncodingUTF16BE!" Then lEncoding = EncodingUTF16BE! End If Return lEncoding end function on w_main.create this.cb_filemd52=create cb_filemd52 this.st_4=create st_4 this.cb_filemd51=create cb_filemd51 this.mle_outfile=create mle_outfile this.st_3=create st_3 this.st_2=create st_2 this.st_1=create st_1 this.ddlb_encoding=create ddlb_encoding this.mle_output=create mle_output this.mle_input=create mle_input this.cb_md52=create cb_md52 this.cb_md51=create cb_md51 this.gb_1=create gb_1 this.gb_2=create gb_2 this.Control[]={this.cb_filemd52,& this.st_4,& this.cb_filemd51,& this.mle_outfile,& this.st_3,& this.st_2,& this.st_1,& this.ddlb_encoding,& this.mle_output,& this.mle_input,& this.cb_md52,& this.cb_md51,& this.gb_1,& this.gb_2} end on on w_main.destroy destroy(this.cb_filemd52) destroy(this.st_4) destroy(this.cb_filemd51) destroy(this.mle_outfile) destroy(this.st_3) destroy(this.st_2) destroy(this.st_1) destroy(this.ddlb_encoding) destroy(this.mle_output) destroy(this.mle_input) destroy(this.cb_md52) destroy(this.cb_md51) destroy(this.gb_1) destroy(this.gb_2) end on type cb_filemd52 from commandbutton within w_main integer x = 1733 integer y = 1096 integer width = 539 integer height = 112 integer taborder = 40 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "File MD5 Method 2" end type event clicked;Integer ll_return String ls_file, ls_name, ls_txt_file String ls_err, ls_md5 Int li_ret nvo_md5 lnvo_md5 ll_return = GetFileSaveName("Select File", ls_file, ls_name, "*.*" , "All Files (*.*),*.*") If ll_return = 1 Then If FileExists ( ls_file ) Then Else MessageBox("Warning", "Please Choose File") Return End If Else Return; End If ls_err = lnvo_md5.of_md5file( ls_file, ls_md5) If ls_err <> "" Then mle_outfile.Text = ls_err Else mle_outfile.Text = ls_md5 End If end event type st_4 from statictext within w_main integer x = 114 integer y = 1184 integer width = 343 integer height = 76 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Output Text:" boolean focusrectangle = false end type type cb_filemd51 from commandbutton within w_main integer x = 1166 integer y = 1096 integer width = 539 integer height = 112 integer taborder = 50 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "File MD5 Method 1" end type event clicked;Integer ll_return String ls_file, ls_name, ls_txt_file String ls_err, ls_md5 Int li_ret nvo_md5 lnvo_md5 ll_return = GetFileSaveName("Select File", ls_file, ls_name, "*.*" , "All Files (*.*),*.*") If ll_return = 1 Then If FileExists ( ls_file ) Then Else MessageBox("Warning", "Please Choose File") Return End If Else Return; End If li_ret = lnvo_md5.of_md5file_ole( ls_file, ls_err, ls_md5) If li_ret = -1 Then mle_outfile.Text = ls_err Else mle_outfile.Text = ls_md5 End If end event type mle_outfile from multilineedit within w_main integer x = 105 integer y = 1272 integer width = 2167 integer height = 220 integer taborder = 30 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type st_3 from statictext within w_main integer x = 119 integer y = 612 integer width = 343 integer height = 76 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Output Text:" boolean focusrectangle = false end type type st_2 from statictext within w_main integer x = 119 integer y = 288 integer width = 329 integer height = 76 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Input Text:" boolean focusrectangle = false end type type st_1 from statictext within w_main integer x = 105 integer y = 152 integer width = 315 integer height = 76 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Encoding:" boolean focusrectangle = false end type type ddlb_encoding from dropdownlistbox within w_main integer x = 421 integer y = 148 integer width = 745 integer height = 400 integer taborder = 10 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 boolean sorted = false string item[] = {"EncodingANSI!","EncodingUTF8!","EncodingUTF16LE!","EncodingUTF16BE!"} borderstyle borderstyle = stylelowered! end type event constructor;ddlb_encoding.selectitem( 2) end event type mle_output from multilineedit within w_main integer x = 105 integer y = 700 integer width = 2167 integer height = 220 integer taborder = 20 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type mle_input from multilineedit within w_main integer x = 105 integer y = 368 integer width = 2167 integer height = 220 integer taborder = 10 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type cb_md52 from commandbutton within w_main integer x = 1198 integer y = 256 integer width = 686 integer height = 96 integer taborder = 20 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Generate MD5 Method 2" end type event clicked;String ls_input, ls_output encoding aencoding nvo_md5 lnvo_md5 mle_output.Text = "" aencoding = wf_getencoding( ) ls_input = mle_input.Text If ls_input = "" Or Len(Trim(ls_input)) = 0 Then mle_input.setfocus( ) Return End If lnvo_md5.of_md5string(ls_input, ls_output, aencoding) mle_output.Text = ls_output end event type cb_md51 from commandbutton within w_main integer x = 1198 integer y = 148 integer width = 686 integer height = 96 integer taborder = 10 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Generate MD5 Method 1" end type event clicked;String ls_input, ls_output encoding aencoding nvo_md5 lnvo_md5 mle_output.Text = "" aencoding = wf_getencoding( ) ls_input = mle_input.Text If ls_input = "" Or Len(Trim(ls_input)) = 0 Then mle_input.setfocus( ) Return End If ls_output = lnvo_md5.of_md5( ls_input, aencoding) mle_output.Text = ls_output end event type gb_1 from groupbox within w_main integer x = 14 integer y = 52 integer width = 2350 integer height = 940 integer taborder = 30 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Generate MD5" end type type gb_2 from groupbox within w_main integer x = 14 integer y = 1036 integer width = 2350 integer height = 520 integer taborder = 30 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Check File MD5" end type |
Find Projects On Github click here
Good Luck!
Subscribe
Login
0 Comments
Oldest