anchor.diff:  %%% Create and initialize a new state for encryption or decryption
   %%% 
   
  +-spec crypto_init(Cipher, Key, EncryptFlag) -> State | ng_crypto_error()
  +                                                   when Cipher :: block_cipher_without_iv()
  +                                                                | stream_cipher_no_iv(),
  +                                                        Key :: iodata(),
  +                                                        EncryptFlag :: boolean(),
  +                                                        State :: crypto_state() .
  +crypto_init(Cipher, Key, EncryptFlag) ->
  +    %% The IV is supposed to be supplied by calling crypto_update/3
  +    ng_crypto_init_nif(alias(Cipher), iolist_to_binary(Key), <<>>, EncryptFlag).
  +
  +
   -spec crypto_init(Cipher, Key, IV, EncryptFlag) -> State | ng_crypto_error()
  -                                                       when Cipher :: stream_cipher()
  -                                                                    | block_cipher_with_iv()
  -                                                                    | block_cipher_without_iv(),
  +                                                       when Cipher :: stream_cipher_iv()
  +                                                                    | block_cipher_with_iv(),
                                                               Key :: iodata(),
  -                                                            IV :: iodata() | undefined,
  +                                                            IV :: iodata(),
                                                               EncryptFlag :: boolean(),
                                                               State :: crypto_state() .
  -crypto_init(Cipher, Key, undefined, EncryptFlag) ->
  +crypto_init(Cipher, Key, IV, EncryptFlag) ->
  +    ng_crypto_init_nif(alias(Cipher), iolist_to_binary(Key), iolist_to_binary(IV), EncryptFlag).
  +
  +
  +
  +%%%----------------------------------------------------------------
  +-spec crypto_init_dyn_iv(Cipher, Key, EncryptFlag) -> State | ng_crypto_error()
  +                                                          when Cipher :: stream_cipher_iv()
  +                                                                       | block_cipher_with_iv(),
  +                                                               Key :: iodata(),
  +                                                               EncryptFlag :: boolean(),
  +                                                               State :: crypto_state() .
  +crypto_init_dyn_iv(Cipher, Key, EncryptFlag) ->
       %% The IV is supposed to be supplied by calling crypto_update/3
  -    ng_crypto_init_nif(alias(Cipher),
  -                       iolist_to_binary(Key), undefined,
  -                       EncryptFlag);
  -
  -crypto_init(Cipher, Key, IV, EncryptFlag) ->
  -    ng_crypto_init_nif(alias(Cipher),
  -                       iolist_to_binary(Key), iolist_to_binary(IV),
  -                       EncryptFlag).
  +    ng_crypto_init_nif(alias(Cipher), iolist_to_binary(Key), undefined, EncryptFlag).
   
   %%%----------------------------------------------------------------
   %%%
  
positive.code:         Data ->
              ng_crypto_update_nif(State, Data, iolist_to_binary(IV))
      end.
  
  
  %%%----------------------------------------------------------------
  %%%
  
negative.code:     end.
  
  
  %%%----------------------------------------------------------------
  -spec crypto_update_dyn_iv(State, Data, IV) -> Result | ng_crypto_error()
                                                     when State :: crypto_state(),
                                                          Data :: iodata(),
                                                          IV :: iodata(),
                                                          Result :: binary() .
  crypto_update_dyn_iv(State, Data0, IV) ->
      %% When State is from State = crypto_init(Cipher, Key, undefined, EncryptFlag)
      case iolist_to_binary(Data0) of
          <<>> ->
  