3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Création nombre arbitraire $nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); // Création d'une clé secrète $key = sodium_crypto_secretbox_keygen(); // Notre message à chiffrer $message = 'Notre message super secret!'; /** * Chiffrer le message, et stocker le texte chiffré résultant avec le nonce. * Contrairement à la clé, le nonce n'a pas besoin d'être secret. */ $cipher = sodium_crypto_secretbox($message, $nonce, $key); // Décrypter le texte chiffré en utilisant la même clé et nonce $decipher = sodium_crypto_secretbox_open($cipher, $nonce, $key); echo $decipher;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CLWVB
function name:  (null)
number of ops:  23
compiled vars:  !0 = $nonce, !1 = $key, !2 = $message, !3 = $cipher, !4 = $decipher
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'random_bytes'
          1        FETCH_CONSTANT                                   ~5      'SODIUM_CRYPTO_SECRETBOX_NONCEBYTES'
          2        SEND_VAL                                                 ~5
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !0, $6
    7     5        INIT_FCALL_BY_NAME                                       'sodium_crypto_secretbox_keygen'
          6        DO_FCALL                                      0  $8      
          7        ASSIGN                                                   !1, $8
   10     8        ASSIGN                                                   !2, 'Notre+message+super+secret%21'
   16     9        INIT_FCALL_BY_NAME                                       'sodium_crypto_secretbox'
         10        SEND_VAR_EX                                              !2
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0  $11     
         14        ASSIGN                                                   !3, $11
   19    15        INIT_FCALL_BY_NAME                                       'sodium_crypto_secretbox_open'
         16        SEND_VAR_EX                                              !3
         17        SEND_VAR_EX                                              !0
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0  $13     
         20        ASSIGN                                                   !4, $13
   21    21        ECHO                                                     !4
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.37 ms | 1395 KiB | 15 Q