3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Keys taken from the phpecc unit tests, but that library's still vulnerable * to several side-channels, so don't use it. */ $private = '-----BEGIN EC PRIVATE KEY----- MHQCAQEEIOZ0ioEAxAkAH/7gnZZWIvReXfez9ahXMpOwHzdEkvKcoAcGBSuBBAAK oUQDQgAE8bjuAc1ucXAA/LbG9i2DSSD8pdgsze34XPD+ddINq3IR/F7TbNvHJdYL alPIMqm0GJuVB+UGg5duB+921yHYPQ== -----END EC PRIVATE KEY-----'; $public = '-----BEGIN PUBLIC KEY----- MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE8bjuAc1ucXAA/LbG9i2DSSD8pdgsze34 XPD+ddINq3IR/F7TbNvHJdYLalPIMqm0GJuVB+UGg5duB+921yHYPQ== -----END PUBLIC KEY-----'; $privateKey = openssl_pkey_get_private($private); $publicKey = openssl_pkey_get_public($public); $data = /* file_get_contents("download.zip")*/ 'Foo bar'; $res = openssl_sign($data, $signature, $privateKey, OPENSSL_ALGO_SHA256); var_dump(base64_encode($signature)); $ok = openssl_verify($data, $signature, $publicKey, OPENSSL_ALGO_SHA256); var_dump($ok);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E1C9Y
function name:  (null)
number of ops:  37
compiled vars:  !0 = $private, !1 = $public, !2 = $privateKey, !3 = $publicKey, !4 = $data, !5 = $res, !6 = $signature, !7 = $ok
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, '-----BEGIN+EC+PRIVATE+KEY-----%0AMHQCAQEEIOZ0ioEAxAkAH%2F7gnZZWIvReXfez9ahXMpOwHzdEkvKcoAcGBSuBBAAK%0AoUQDQgAE8bjuAc1ucXAA%2FLbG9i2DSSD8pdgsze34XPD%2BddINq3IR%2FF7TbNvHJdYL%0AalPIMqm0GJuVB%2BUGg5duB%2B921yHYPQ%3D%3D%0A-----END+EC+PRIVATE+KEY-----'
   13     1        ASSIGN                                                   !1, '-----BEGIN+PUBLIC+KEY-----%0AMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE8bjuAc1ucXAA%2FLbG9i2DSSD8pdgsze34%0AXPD%2BddINq3IR%2FF7TbNvHJdYLalPIMqm0GJuVB%2BUGg5duB%2B921yHYPQ%3D%3D%0A-----END+PUBLIC+KEY-----'
   18     2        INIT_FCALL_BY_NAME                                       'openssl_pkey_get_private'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $10     
          5        ASSIGN                                                   !2, $10
   19     6        INIT_FCALL_BY_NAME                                       'openssl_pkey_get_public'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0  $12     
          9        ASSIGN                                                   !3, $12
   21    10        ASSIGN                                                   !4, 'Foo+bar'
   22    11        INIT_FCALL_BY_NAME                                       'openssl_sign'
         12        SEND_VAR_EX                                              !4
         13        SEND_VAR_EX                                              !6
         14        SEND_VAR_EX                                              !2
         15        FETCH_CONSTANT                                   ~15     'OPENSSL_ALGO_SHA256'
         16        SEND_VAL_EX                                              ~15
         17        DO_FCALL                                      0  $16     
         18        ASSIGN                                                   !5, $16
   23    19        INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'base64_encode'
         21        SEND_VAR                                                 !6
         22        DO_ICALL                                         $18     
         23        SEND_VAR                                                 $18
         24        DO_ICALL                                                 
   25    25        INIT_FCALL_BY_NAME                                       'openssl_verify'
         26        SEND_VAR_EX                                              !4
         27        SEND_VAR_EX                                              !6
         28        SEND_VAR_EX                                              !3
         29        FETCH_CONSTANT                                   ~20     'OPENSSL_ALGO_SHA256'
         30        SEND_VAL_EX                                              ~20
         31        DO_FCALL                                      0  $21     
         32        ASSIGN                                                   !7, $21
   26    33        INIT_FCALL                                               'var_dump'
         34        SEND_VAR                                                 !7
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.89 ms | 991 KiB | 15 Q