3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hash = md5('test'); $s =encrypt_blowfish('123123123123', $hash); decrypt_blowfish($s, $hash); function decrypt_blowfish($data, $key) { $iv = pack("H*", substr($data, 0, 16)); $x = pack("H*", substr($data, 16)); while (strlen($iv) < mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CBC)) { $iv .= "\0"; } $res = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $x, MCRYPT_MODE_CBC, $iv); return $res; } function encrypt_blowfish($data, $key) { $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $crypttext = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $data, MCRYPT_MODE_CBC, $iv); return bin2hex($iv . $crypttext); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2dfI1
function name:  (null)
number of ops:  14
compiled vars:  !0 = $hash, !1 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'md5'
          1        SEND_VAL                                                 'test'
          2        DO_ICALL                                         $2      
          3        ASSIGN                                                   !0, $2
    3     4        INIT_FCALL_BY_NAME                                       'encrypt_blowfish'
          5        SEND_VAL_EX                                              '123123123123'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $4      
          8        ASSIGN                                                   !1, $4
    4     9        INIT_FCALL_BY_NAME                                       'decrypt_blowfish'
         10        SEND_VAR_EX                                              !1
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0          
   21    13      > RETURN                                                   1

Function decrypt_blowfish:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 22
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 22
Branch analysis from position: 32
Branch analysis from position: 22
filename:       /in/2dfI1
function name:  decrypt_blowfish
number of ops:  44
compiled vars:  !0 = $data, !1 = $key, !2 = $iv, !3 = $x, !4 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'pack'
          3        SEND_VAL                                                 'H%2A'
          4        INIT_FCALL                                               'substr'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 0
          7        SEND_VAL                                                 16
          8        DO_ICALL                                         $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !2, $6
    8    12        INIT_FCALL                                               'pack'
         13        SEND_VAL                                                 'H%2A'
         14        INIT_FCALL                                               'substr'
         15        SEND_VAR                                                 !0
         16        SEND_VAL                                                 16
         17        DO_ICALL                                         $8      
         18        SEND_VAR                                                 $8
         19        DO_ICALL                                         $9      
         20        ASSIGN                                                   !3, $9
    9    21      > JMP                                                      ->23
   10    22    >   ASSIGN_OP                                     8          !2, '%00'
    9    23    >   STRLEN                                           ~12     !2
         24        INIT_FCALL_BY_NAME                                       'mcrypt_get_iv_size'
         25        FETCH_CONSTANT                                   ~13     'MCRYPT_BLOWFISH'
         26        SEND_VAL_EX                                              ~13
         27        FETCH_CONSTANT                                   ~14     'MCRYPT_MODE_CBC'
         28        SEND_VAL_EX                                              ~14
         29        DO_FCALL                                      0  $15     
         30        IS_SMALLER                                               ~12, $15
         31      > JMPNZ                                                    ~16, ->22
   12    32    >   INIT_FCALL_BY_NAME                                       'mcrypt_decrypt'
         33        FETCH_CONSTANT                                   ~17     'MCRYPT_BLOWFISH'
         34        SEND_VAL_EX                                              ~17
         35        SEND_VAR_EX                                              !1
         36        SEND_VAR_EX                                              !3
         37        FETCH_CONSTANT                                   ~18     'MCRYPT_MODE_CBC'
         38        SEND_VAL_EX                                              ~18
         39        SEND_VAR_EX                                              !2
         40        DO_FCALL                                      0  $19     
         41        ASSIGN                                                   !4, $19
   13    42      > RETURN                                                   !4
   14    43*     > RETURN                                                   null

End of function decrypt_blowfish

Function encrypt_blowfish:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2dfI1
function name:  encrypt_blowfish
number of ops:  31
compiled vars:  !0 = $data, !1 = $key, !2 = $iv_size, !3 = $iv, !4 = $crypttext
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        INIT_FCALL_BY_NAME                                       'mcrypt_get_iv_size'
          3        FETCH_CONSTANT                                   ~5      'MCRYPT_BLOWFISH'
          4        SEND_VAL_EX                                              ~5
          5        FETCH_CONSTANT                                   ~6      'MCRYPT_MODE_CBC'
          6        SEND_VAL_EX                                              ~6
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !2, $7
   18     9        INIT_FCALL_BY_NAME                                       'mcrypt_create_iv'
         10        SEND_VAR_EX                                              !2
         11        FETCH_CONSTANT                                   ~9      'MCRYPT_RAND'
         12        SEND_VAL_EX                                              ~9
         13        DO_FCALL                                      0  $10     
         14        ASSIGN                                                   !3, $10
   19    15        INIT_FCALL_BY_NAME                                       'mcrypt_encrypt'
         16        FETCH_CONSTANT                                   ~12     'MCRYPT_BLOWFISH'
         17        SEND_VAL_EX                                              ~12
         18        SEND_VAR_EX                                              !1
         19        SEND_VAR_EX                                              !0
         20        FETCH_CONSTANT                                   ~13     'MCRYPT_MODE_CBC'
         21        SEND_VAL_EX                                              ~13
         22        SEND_VAR_EX                                              !3
         23        DO_FCALL                                      0  $14     
         24        ASSIGN                                                   !4, $14
   20    25        INIT_FCALL                                               'bin2hex'
         26        CONCAT                                           ~16     !3, !4
         27        SEND_VAL                                                 ~16
         28        DO_ICALL                                         $17     
         29      > RETURN                                                   $17
   21    30*     > RETURN                                                   null

End of function encrypt_blowfish

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.95 ms | 1404 KiB | 21 Q