3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Some example variables: $alice_ecdh_secret = "\x69\xf2\x08\x41\x2d\x8d\xd5\xdb\x9d\x0c\x6d\x18\x51\x2e\x86\xf0" . "\xec\x75\x66\x5a\xb8\x41\x37\x2d\x57\xb0\x42\xb2\x7e\xf8\x9d\x8c"; $bob_ecdh_public = "\xe8\x98\x0c\x86\xe0\x32\xf1\xeb\x29\x75\x05\x2e\x8d\x65\xbd\xdd" . "\x15\xc3\xb5\x96\x41\x17\x4e\xc9\x67\x8a\x53\x78\x9d\x92\xc7\x54"; $message_keypair = sodium_crypto_box_keypair_from_secretkey_and_publickey( $alice_ecdh_secret, $bob_ecdh_public ); $plaintext = "This is a secret message for your eyes only."; $nonce = random_bytes(24); // And now for the actual public-key encryption step: $ciphertext = sodium_crypto_box($plaintext, $nonce, $message_keypair); //To decrypt a message: $received = sodium_crypto_box_open( $ciphertext, $nonce, $message_keypair ); echo $received;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hnRor
function name:  (null)
number of ops:  26
compiled vars:  !0 = $alice_ecdh_secret, !1 = $bob_ecdh_public, !2 = $message_keypair, !3 = $plaintext, !4 = $nonce, !5 = $ciphertext, !6 = $received
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'i%F2%08A-%8D%D5%DB%9D%0Cm%18Q.%86%F0%ECufZ%B8A7-W%B0B%B2%7E%F8%9D%8C'
    6     1        ASSIGN                                                   !1, '%E8%98%0C%86%E02%F1%EB%29u%05.%8De%BD%DD%15%C3%B5%96A%17N%C9g%8ASx%9D%92%C7T'
    9     2        INIT_FCALL_BY_NAME                                       'sodium_crypto_box_keypair_from_secretkey_and_publickey'
   10     3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
    9     5        DO_FCALL                                      0  $9      
          6        ASSIGN                                                   !2, $9
   13     7        ASSIGN                                                   !3, 'This+is+a+secret+message+for+your+eyes+only.'
   14     8        INIT_FCALL                                               'random_bytes'
          9        SEND_VAL                                                 24
         10        DO_ICALL                                         $12     
         11        ASSIGN                                                   !4, $12
   17    12        INIT_FCALL_BY_NAME                                       'sodium_crypto_box'
         13        SEND_VAR_EX                                              !3
         14        SEND_VAR_EX                                              !4
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0  $14     
         17        ASSIGN                                                   !5, $14
   21    18        INIT_FCALL_BY_NAME                                       'sodium_crypto_box_open'
   22    19        SEND_VAR_EX                                              !5
         20        SEND_VAR_EX                                              !4
         21        SEND_VAR_EX                                              !2
   21    22        DO_FCALL                                      0  $16     
         23        ASSIGN                                                   !6, $16
   26    24        ECHO                                                     !6
   27    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.93 ms | 997 KiB | 14 Q