How to get sql that encodes password from symfony

What i need

  • i need sql similar to encodePassword does as in symfony in Oracle.

  • I tried to find encryption string using SHA512 which give me very length string.

Symfony code

   public function encodePassword(UserInterface $user, $plainPassword)
   {
      $encoder = $this->encoderFactory->getEncoder($user);
      $plainPassword='hello world';
      return $encoder->encodePassword($plainPassword, $user->getSalt());
    } 

give me output

example $2y$13$u5wqc1JNqFv1F4JXlmXbCORFU1./s/6HslG79q4tk3YLSBD..ihmi

Oracle snippet

                   declare
              p_string varchar2(2000) := 'hello world';
              lv_hash_key_sh512   raw (1000);
              lv_varchar_key_sh512   varchar2 (32000);
            begin
            
                lv_hash_key_sh512 :=
                 dbms_crypto.hash (src   => utl_raw.cast_to_raw (p_string),
                                   typ   => dbms_crypto.HASH_SH512);
            
              -- convert into varchar2
              select   lower (to_char (rawtohex (lv_hash_key_sh512)))
                into   lv_varchar_key_sh512
                from   dual;
            
            
              dbms_output.put_line('String to encrypt : '||p_string);
              dbms_output.put_line('SHA512 encryption : '||lv_varchar_key_sh512);
            end;

Output
SHA512 encryption : 8d29c8ecbe0f17756f7b1e86c1307a09f5825be85049f607cf952f0d788

  • i need password encryption in oracle so that symfony fos user bundle will accept the password.

  • any suggestion is most welcome.

Refrence
https://docs.oracle.com/database/121/ARPLS/d_crypto.htm#ARPLS65675

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *