@codeinahat/crypto
v2.5.6
Published
JS crypto Library
Downloads
142
Maintainers
Readme
��#� �C�o�d�e�i�n�a�h�a�t� �C�r�y�p�t�o�
�
�
�
�#�#� �I�n�s�t�a�l�l�a�t�i�o�n�
�
�T�h�i�s� �i�n� �[�N�o�d�e�.�j�s�]�(�h�t�t�p�s�:�/�/�n�o�d�e�j�s�.�o�r�g�)� �m�o�d�u�l�e� �a�v�a�i�l�a�b�l�e� �t�h�r�o�u�g�h� �t�h�e� �[�n�p�m� �r�e�g�i�s�t�r�y�]�(�h�t�t�p�s�:�/�/�n�p�m�j�s�.�c�o�m�)�.�
�
�I�n�s�t�a�l�l�a�t�i�o�n� �i�s� �d�o�n�e� �u�s�i�n�g� �t�h�e� �[��n�p�m� �i�n�s�t�a�l�l�� �c�o�m�m�a�n�d�]�(�h�t�t�p�s�:�/�/�d�o�c�s�.�n�p�m�j�s�.�c�o�m�/�d�o�w�n�l�o�a�d�i�n�g�-�a�n�d�-�i�n�s�t�a�l�l�i�n�g�-�p�a�c�k�a�g�e�s�-�l�o�c�a�l�l�y�)�
�
�
�
����s�h�
�
� � � � �$� �n�p�m� �i�n�s�t�a�l�l� �@�c�o�d�e�i�n�a�h�a�t�/�c�r�y�p�t�o�
�
����
�
�
�
�#�#� �A�P�I�
�
�
�
����j�s�
�
� � � � �c�o�n�s�t� �c�o�d�e�h�a�t� �=� �r�e�q�u�i�r�e�(�'�@�c�o�d�e�i�n�a�h�a�t�/�c�r�y�p�t�o�'�)�
�
����
�
�
�
�#�#� �C�l�a�s�s�e�s�
�
�
�
�T�h�e�r�e� �a�r�e� �c�u�r�r�e�n�t�l�y� �s�i�x� �a�c�c�e�s�i�b�l�e� �c�l�a�s�s�e�s� �i�n� �t�h�i�s� �m�o�d�u�l�e� �[�U�t�i�l�i�t�i�e�s�]�(�#�#�#�u�t�i�l�i�t�i�e�s�)� �[�S�a�l�t�]�(�#�#�#�s�a�l�t�)�,� �[�C�r�y�p�t�o�]�(�#�#�#�c�r�y�p�t�o�)�,� ��K�e�y�A�n�d�S�e�q�u�e�n�c�e��,� �a�n�d� ��K�e�y�A�n�d�S�e�q�u�e�n�c�e�R�e�s�u�l�t��.�
�
�Y�o�u� �s�h�o�u�l�d� �n�o�t� �h�a�v�e� �t�o� �i�n�t�e�r�a�c�t� �a�t� �a�l�l� �w�i�t�h� ��K�e�y�A�n�d�S�e�q�u�e�n�c�e�� �a�n�d� ��K�e�y�A�n�d�S�e�q�u�e�n�c�e�R�e�s�u�l�t�� �t�h�e�y� �a�r�e� �p�r�o�v�i�d�e�r� �i�n� �c�a�s�e� �t�h�a�t� �y�o�u� �n�e�e�d� �s�o�m�e� �f�l�e�x�i�b�i�l�i�t�y� �t�h�a�t� �t�h�e� �m�o�d�u�l�e� �d�o�e�s� �n�o�t� �a�l�r�e�a�d�y� �o�f�f�e�r�.�
�
�I�f� �y�o�u� �u�s�e� ��K�e�y�A�n�d�S�e�q�u�e�n�c�e��,� �a�n�d� ��K�e�y�A�n�d�S�e�q�u�e�n�c�e�R�e�s�u�l�t�� �m�a�k�e� �s�u�r�e� �y�o�u� �a�r�e� ��f�a�m�i�l�i�a�r�� �w�i�t�h� �c�o�d�e�.�
�
�
�
�#�#�#� �S�a�l�t�
�
�
�
�S�a�l�t� �o�n�l�y� �h�a�s� �o�n�e� ��m�e�t�h�o�d�� �t�h�a�t� �y�o�u� �n�e�e�d� �t�o� �c�o�n�c�e�r�n� �y�o�u�r�s�e�l�f� �w�i�t�h�;� ��g�e�n�e�r�a�t�e��.� �T�h�i�s� �m�e�t�h�o�d� �w�i�l�l� �r�e�t�u�r�n� �a� ��s�t�r�i�n�g�� �o�f� �r�a�n�d�o�m� �c�h�a�r�a�c�t�e�r�s�.�
�
����j�s�
�
� � � � �/�/� �c�a�l�l� �t�h�e� �A�P�I�
�
� � � � �c�o�n�s�t� �c�o�d�e�h�a�t� �=� �r�e�q�u�i�r�e�(�'�@�c�o�d�e�i�n�a�h�a�t�/�c�r�y�p�t�o�'�)�;�
�
�
�
� � � � �/�/� �i�n�s�t�a�n�c�i�a�t�e� �t�h�e� �c�l�a�s�s�
�
� � � � �c�o�n�s�t� �s�a�l�t� �=� �n�e�w� �c�o�d�e�h�a�t�.�S�a�l�t�(�)�;�
�
�
�
� � � � �/�/� �g�e�n�e�r�a�t�e� �r�a�n�d�o�m� �s�t�r�i�n�g� �o�f� �c�h�a�r�a�c�t�e�r�s�
�
� � � � �c�o�n�s�t� �n�e�w�S�a�l�t� �=� �s�a�l�t�.�g�e�n�e�r�a�t�e�(�)�;�
�
�
�
� � � � �/�/� �p�r�i�n�t�s� �o�u�t� �t�h�e� �s�t�r�i�n�g� �o�f� �r�a�n�d�o�m� �c�h�a�r�a�c�t�e�r�s�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�n�e�w�S�a�l�t�)�;�
�
����
�
�
�
�Y�o�u� �c�a�n� �m�o�d�i�f�y� �t�h�e� ��l�e�n�g�t�h�� �o�f� �t�h�e� �s�t�r�i�n�g� �o�f� �c�h�a�r�a�c�t�e�r�s�.� �B�y� �p�a�s�s�i�n�g� �t�h�e� �f�i�r�s�t� �p�a�r�a�m�e�t�e�r� �t�o� �t�h�e� ��g�e�n�e�r�a�t�e�� �m�e�t�h�o�d�.� �T�h�e� �d�e�f�a�u�l�t� �v�a�l�u�e� �i�s� �1�0�
�
�i�f� �y�o�u� �d�o�n�'�t� �p�a�s�s� �a�n�y�t�h�i�n�g�.�
�
����j�s�
�
� � � � �/�/� �i�s�t�a�n�c�i�a�t�e� �t�h�e� �c�l�a�s�s�
�
� � � � �c�o�n�s�t� �s�a�l�t� �=� �n�e�w� �c�o�d�e�h�a�t�.�S�a�l�t�(�)�;�
�
�
�
� � � � �/�/� �c�a�l�l� �t�h�e� �g�e�n�e�r�a�t�e� �m�e�t�h�o�d� �b�u�t� �t�h�i�s� �t�i�m�e� �p�a�s�s� �t�h�e� �k�e�y�L�e�n�g�t�h� �p�a�r�a�m�e�t�e�r�
�
� � � � �c�o�n�s�t� �n�e�w�S�a�l�t� �=� �s�a�l�t�.�g�e�n�e�r�a�t�e�(�5�0�)�;�
�
� � � � �
�
� � � � �/�/� �n�o�w� �t�h�e� �n�e�w�S�a�l�t� �w�i�l�l� �b�e� �5�0� �c�h�a�r�a�c�t�e�r�s� �l�o�n�g� �o�r� �m�o�r�e�
�
� � � � �/�/� �t�h�i�s� �h�a�p�p�e�n�d� �b�e�c�a�u�s�e� �s�o�m�e� �o�f� �t�h�e� �r�a�n�d�o�m�e� �n�u�m�b�e�r�s� �c�o�u�l�d� �b�e� �t�w�o� �d�i�g�i�t�s�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�n�e�w�S�a�l�t�)�;�
�
����
�
�
�
�Y�o�u� �c�a�n� �m�o�d�i�f�y� �t�h�e� ��d�i�v�e�r�s�i�t�y�� �o�f� �t�h�e� �r�a�n�d�o�m� �v�a�l�u�e�.� �T�h�e� ��d�i�v�e�r�s�i�t�y�� �i�s� �t�h�e� �r�a�n�g�e� �o�f� �n�u�m�b�e�r�s� �a�s� �t�o� �w�h�i�c�h� �t�h�e� �a�l�g�o�r�i�t�h�m� �l�o�o�k�s�
�
�f�o�r� �t�o� �s�e�l�e�c�t� �t�h�e� �r�a�n�d�o�m� �v�a�l�u�e�.� �
�
����j�s�
�
� � � � �/�/� �i�s�t�a�n�c�i�a�t�e� �t�h�e� �c�l�a�s�s�
�
� � � � �c�o�n�s�t� �c�o�d�e�h�a�t� �=� �r�e�q�u�i�r�e�(�'�@�c�o�d�e�i�n�a�h�a�t�/�c�r�y�p�t�o�'�)�
�
� � � � �c�o�n�s�t� �s�a�l�t� �=� �n�e�w� �c�o�d�e�h�a�t�.�S�a�l�t�(�)�;�
�
�
�
� � � � �/�*�*�
�
� � � � � �*� � �c�a�l�l� �t�h�e� �g�e�n�e�r�a�t�e� �m�e�t�h�o�d� �b�u�t� �t�h�i�s� �t�i�m�e� �p�a�s�s� �t�h�e� �r�a�n�g�e� �p�a�r�a�m�e�t�e�r�
�
� � � � � �*� � �w�e� �w�i�l�l� �s�e�t� �t�h�e� �k�e�y�L�e�n�g�t�h� �t�o� �n�u�l�l� �w�h�i�c�h� �w�i�l�l� �g�i�v�e� �y�o�u� �a� �s�t�r�i�n�g� �o�f� �
�
� � � � � �*� � �c�h�a�r�a�t�e�r�s� �o�f� �a�t� �l�e�a�s�t� �1�0� �c�h�a�r�a�c�t�e�r�s�
�
� � � � � �*� �*�/�
�
� � � � �c�o�n�s�t� �n�e�w�S�a�l�t� �=� �s�a�l�t�.�g�e�n�e�r�a�t�e�(�n�u�l�l�,� �{�b�e�g�:� �0�,� �b�e�g�:� �1�0�0�}�)�;�
�
� � � � �
�
� � � � �/�*�*� �
�
� � � � � �*� �i�n�s�t�e�a�d� �o�f� �l�o�o�k�i�n�g� �b�e�t�w�e�e�n� �0� �a�n�d� �2�6� �w�h�i�c�h� �i�s� �t�h�e� �d�e�f�a�u�l�t� �v�a�l�u�e� �i�t� �w�i�l�l�
�
� � � � � �*� �l�o�o�k� �b�e�t�w�e�e�n� �0� �a�n�d� �1�0�0� �t�h�e�r�f�o�r�e� �a�d�d�i�n�g� �m�o�r�e� �d�i�v�e�r�s�i�t�y� �t�o� �e�a�c�h� �c�h�a�r�a�c�t�e�r� �v�a�l�u�e�
�
� � � � � �*� �*�/�
�
����
�
��n�o�t�e�:�� �T�h�e� �b�i�g�g�e�r� �t�h�e� �k�e�y�L�e�n�g�t�h� �i�s� �a�n�d� �t�h�e� �b�i�g�g�e�r� �t�h�e� �r�a�n�g�e� �i�s� �a�d�d�s� �c�o�m�p�l�e�x�i�t�y� �t�o� �y�o�u�r� �s�a�l�t� � �v�a�l�u�e�.�
�
�
�
�#�#� �C�r�y�p�t�o�
�
�
�
�C�r�y�p�t�o� �h�a�s� �s�i�x� ��s�t�a�t�i�c� �m�e�t�h�o�d�s��.� ��k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t��,� ��a�s�y�n�c�K�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t��,� ��k�e�y�S�e�q�u�e�n�c�e�D�e�c�r�y�p�t��,� ��a�s�y�n�c�K�e�y�S�e�q�u�e�n�c�e�D�e�c�r�y�p�t��,� ��d�e�l�e�t�e�K�e�y�D�i�r��,� �a�n�d� ��d�e�l�e�t�e�K�e�y�S�e�q�u�e�n�c�e�F�i�l�e�S�t�o�r�a�g�e��.� �
�
�
�
��k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�� �t�a�k�e�s� �a�n� �a�r�r�a�y� �o�f� ��(�c�h�a�r�a�c�t�e�r�s� �a�n�d�/�o�r� �n�u�m�b�e�r�s�)�� �o�r� �a� ��s�t�r�i�n�g� �o�f� �c�h�a�r�a�c�t�e�r�s�� �a�n�d� �r�e�t�u�r�n�s� �a� ��K�e�y�A�n�d�S�e�q�u�e�n�c�e�R�e�s�u�l�t��.� �
�
�W�h�i�c�h� �g�i�v�e�s� �y�o�u� �a�c�c�e�s�s� �t�o� �t�h�r�e�e� �v�a�l�u�e�s�.� ��k�e�y�R�i�n�g� �(�n�u�m�b�e�r� �a�r�r�a�y�)�� �w�h�i�c�h� �i�s� �t�h�e� �e�n�c�r�y�p�t�e�d� �d�a�t�a�,� ��s�e�q�u�e�n�c�e�� �w�h�i�c�h� �t�h�e� �s�e�q�u�e�n�c�e� �t�h�a�t� �t�h�e� �a�l�g�o�r�i�t�h�m� �
�
�f�o�l�l�o�w�s� �t�o� �d�e�c�r�y�p�t� �t�h�e� �a�r�r�a�y� �o�f� �c�h�a�r�a�c�t�e�r�s� �a�n�d� �n�u�m�b�e�r�s�,� �a�n�d� ��o�n�e�t�i�m�e�V�a�l�u�e�s�� �w�h�i�c�h� �g�i�v�e�s� �y�o�u� �t�h�e� �v�a�r�i�a�b�l�e�s� �o�f� �t�h�e� �m�a�t�h�e�m�a�t�h�i�c�a�l� �e�q�u�a�t�i�o�n� �t�h�a�t� �e�n�c�r�y�p�t�s�
�
� �t�h�e� ��d�a�t�a�� �i�n� �t�h�e� �f�o�r�m� �o�f� �a� �n�u�m�b�e�r� �a�r�r�a�y�.� �T�h�e� ��o�n�e�t�i�m�e�V�a�l�u�e�s�� �c�a�n� �b�e� ��u�n�d�e�f�i�n�e�d�� �o�r� ��n�u�l�l�� �i�f� �y�o�u�r� �u�s�i�n�g� �e�n�c�r�y�p�t�i�o�n� �v�a�r�i�a�b�l�e�s� ��s�t�o�r�e�d� �i�n� �m�e�m�o�r�y��.�
�
�
�
��k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�� �w�i�t�h� ��o�n�e�t�i�m�e�p�a�d��.� ��o�n�e�t�i�m�e�p�a�d�� �i�s� �b�y� �d�e�f�a�u�l�t� �t�r�u�e�;� �T�h�i�s� �m�o�d�e� �r�e�t�u�r�n�s� �t�h�e� ��o�n�e�t�i�m�e�V�a�l�u�e�s�� �t�h�a�t� �t�h�e� �a�l�g�o�r�i�t�h�m� �u�s�e�s� �t�o� �e�n�c�r�y�p�t�
�
�t�h�e� �d�a�t�a�,� �w�i�t�h�o�u�t� �t�h�o�s�e� �v�a�l�u�e�s� �y�o�u�r� �d�a�t�a� �w�o�n�'�t� �b�e� �a�b�l�e� �t�o� �b�e� �d�e�c�r�y�p�t�e�d� �a�n�d� �w�i�l�l� �b�e� ��l�o�s�t� �p�e�r�m�a�n�e�n�t�l�y��.�
�
����j�s�
�
� � � � �/�*�*�
�
� � � � � �*� �i�n�s�t�a�n�c�i�a�t�e� �a� �s�a�l�t� �o�b�j�e�c�t� �w�e� �a�r�e� �g�o�i�n�g� �t�o� �u�s�e� �
�
� � � � � �*� �t�h�e� �k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t� �t�o� �e�n�c�r�y�p�t� �t�h�e� �s�a�l�t� �r�e�s�u�l�t�
�
� � � � � �*� �*�/�
�
� � � � �c�o�n�s�t� �c�o�d�e�h�a�t� �=� �r�e�q�u�i�r�e�(�'�@�c�o�d�e�i�n�a�h�a�t�/�c�r�y�p�t�o�'�)�;�
�
� � � � �c�o�n�s�t� �s�a�l�t� �=� �n�e�w� �c�o�d�e�h�a�t�.�S�a�l�t�(�)�;�
�
� � � � �
�
� � � � �/�/� �g�e�n�e�r�a�t�e� �a� �s�a�l�t�
�
� � � � �c�o�n�s�t� �n�e�w�S�a�l�t� �=� �s�a�l�t�.�g�e�n�e�r�a�t�e�(�)�;�
�
�
�
� � � � �/�/� �e�n�c�r�y�p�t� �t�h�e� �r�e�s�u�l�t�
�
� � � � �c�o�n�s�t� �e�n�c�r�y�p�t�e�d� �=� �c�o�d�e�h�a�t�.�C�r�y�p�t�o�.�k�e�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�(�n�e�w�S�a�l�t�)�;�
�
�
�
� � � � �/�/� �r�e�t�u�r�n�s� �t�h�e� �K�e�y�A�n�d�S�e�q�u�e�n�c�e�R�e�s�u�l�t� �o�b�j�e�c�t�
�
� � � � �/�/� �e�n�c�r�y�p�t�e�d� �v�a�l�u�e�s�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�e�n�c�r�y�p�t�e�d�.�k�e�y�R�i�n�g�)�;�
�
�
�
� � � � �/�/� �e�n�c�r�i�p�t�i�o�n� �s�e�q�u�e�n�c�e�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�e�n�c�r�y�p�t�e�d�.�s�e�q�u�e�n�c�e�)�;�
�
�
�
� � � � �/�/� �o�n�e� �t�i�m�e� �v�a�l�u�e�s�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�e�n�c�r�y�p�t�e�d�.�o�n�e�t�i�m�e�V�a�l�u�e�s�)�
�
����
�
�
�
��k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t��,� �h�o�w�e�v�e�r� �t�h�i�s� �t�i�m�e� �w�e� �w�i�l�l� �u�s�e� �e�n�c�r�y�p�t�i�o�n� �v�a�r�i�a�b�l�e�s� ��s�t�o�r�e�d� �i�n� �m�e�m�o�r�y��.� �T�h�i�s� �i�s� �u�s�e� �w�h�e�n� �y�o�u� �k�e�e�p� �t�h�e� ��e�n�c�r�y�p�t�i�o�n� �v�a�r�i�a�b�l�e�s�� �s�t�o�r�e�d� �i�n� �a� �j�s�o�n� �f�i�l�e�.�
�
�T�h�e� ��m�o�d�u�l�e�� �w�o�u�l�d� �a�t�t�e�m�p�t� �t�o� �c�r�e�a�t�e� �a� ��d�i�r�e�c�t�o�r�y�� �i�n� �y�o�u�r� �r�o�o�t� �d�i�r�e�c�t�o�r�y� �c�a�l�l�e�d� ��k�e�y�s�� �a�n�d� �s�a�v�e� �a� �f�i�l�e� �i�n� �t�h�e�r�e� �w�i�t�h� �t�h�e� ��e�n�c�r�y�p�t�i�o�n� �v�a�r�i�a�b�l�e�s��.� �Y�o�u�r� ��n�o�t�� �r�e�q�u�i�r�e� �t�o� �
�
�c�r�e�a�t�e� �t�h�i�s� �f�i�l�e� �m�a�n�u�a�l�l�y� �a�n�d� �i�t� �i�s� ��N�O�T�� �r�e�c�o�m�e�n�d�e�d� �t�h�a�t� �y�o�u� �d�o� �o�r� �m�e�s�s� �w�i�t�h� �t�h�i�s� �f�i�l�e� �u�n�l�e�s�s� �y�o�u� �a�r� �a�b�s�o�l�u�t�l�y� �s�u�r�e� �t�h�a�t� �y�o�u� �k�n�o�w� �w�h�a�t� �y�o�u�r� �d�o�i�n�g�.� �T�h�i�s� ��f�i�l�e�� �i�s� �u�s�e�d�
�
�t�o� �e�n�c�r�y�p�t� �a�n�d� �d�e�c�r�y�p�t� �a�l�l� �y�o�u� �d�a�t�a�.� �O�n�c�e� �i�n� ��p�r�o�d�u�c�t�i�o�n�� �i�f� �y�o�u� �u�s�e� �t�h�i�s� �m�e�t�h�o�t� �t�o� ��e�n�c�r�y�p�t�� �y�o�u�r� �d�a�t�a� �a�n�d� �t�h�e� �f�i�l�e� �g�e�t�s� ��c�o�r�r�u�p�t�e�d�� �o�r� ��d�e�l�e�t�e�d�� �y�o�u� �w�i�l�l� �n�o�t� �b�e� �a�b�l�e�
�
�t�o� ��d�e�c�r�y�p�t�� �t�h�e� ��u�s�e�r� �d�a�t�a�� �a�l�r�e�a�d�y� ��e�n�c�r�y�p�t�e�d��.�
�
����j�s�
�
� � � � �/�*�*�
�
� � � � � �*� �i�n�s�t�a�n�c�i�a�t�e� �a� �s�a�l�t� �o�b�j�e�c�t� �w�e� �a�r� �g�o�i�n�g� �t�o� �u�s�e�
�
� � � � � �*� �t�h�e� �k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t� �t�i� �e�n�c�r�y�p�t� �t�h�e� �s�a�l�t� �r�e�s�u�l�t�
�
� � � � � �*� � �*�/�
�
� � � � �c�o�n�s�t� �c�o�d�e�h�a�t� �=� �r�e�q�u�i�r�e�(�'�@�c�o�d�e�i�n�a�h�a�t�/�c�r�y�p�t�o�'�)�;�
�
� � � � �c�o�n�s�t� �s�a�l�t� �=� �n�e�w� �c�o�d�e�h�a�t�.�S�a�l�t�(�)�;�
�
�
�
� � � � �/�/� �g�e�n�e�r�a�t�e� �s�a�l�t�
�
� � � � �c�o�n�s�t� �n�e�w�S�a�l�t� �=� �s�a�l�t�.�g�e�n�e�r�a�t�e�(�)�;�
�
�
�
� � � � �/�*�*�
�
� � � � � �*� �e�n�c�r�y�p�t� �t�h�e� �r�e�s�u�l�t� �o�n�l�y� �t�h�i�s� �t�i�m�e� �w�e� �w�i�l�l� �s�e�t� �t�h�e� �o�n�e�t�i�m�e�p�a�d�
�
� � � � � �*� �t�o� �f�a�l�s�e�
�
� � � � � �*� �*�/�
�
� � � � �c�o�n�s�t� �e�n�c�r�y�p�t�e�d� �=� �c�o�d�e�h�a�t�.�C�r�y�p�t�o�.�k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�(�n�e�w�S�a�l�t�,� �f�a�l�s�e�)�;�
�
�
�
� � � � �/�*�*�
�
� � � � � �*� �T�h�e� �p�r�o�g�r�a�m� �w�i�l�l� �a�t�t�e�m�p�t� �t�o� �c�r�e�a�t�e� �a� �f�o�l�d�e�r� �c�a�l�l�e�d� �k�e�y�s� �i�n� �y�o�u�r� �r�o�o�t�
�
� � � � � �*� �d�i�r�e�c�t�o�r�y� �i�f� �i�t� �d�o�e�s� �n�o�t� �e�x�i�s�t�.� �T�h�e�n� �i�t� �w�i�l�l� �a�t�t�e�m�p�t� �t�o� �c�r�e�a�t�e� �a� �f�i�l�e�
�
� � � � � �*� �w�i�t�h� �t�h�e� �e�n�c�r�y�p�t�i�o�n� �v�a�r�i�a�b�l�e�s� �i�f� �i�t� �d�o�e�s� �n�o�t� �a�l�r�a�d�y� �e�x�i�s�t�.�
�
� � � � � �*� �*�/�
�
� � � � �
�
� � � � �/�/� �r�e�t�u�r�n�s� �t�h�e� �K�e�y�A�n�d�S�e�q�u�e�n�c�e�R�e�s�u�l�t� �o�b�j�e�c�t�
�
� � � � �/�/� �o�n�l�y� �t�h�i�s� �t�h�i�s� �t�i�m�e� �o�n�e�t�i�m�e�V�a�l�u�e�s� �i�s� �n�u�l�l� �o�r� �u�n�d�e�f�i�n�e�d�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�e�n�c�r�y�p�t�e�d�.�k�e�y�R�i�n�g�)�
�
� � � � �/�/� �=�>� �o�u�t�p�u�t�s� �n�u�m�b�e�r� �a�r�r�a�y�
�
�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�e�n�c�r�y�p�t�e�d�.�s�e�q�u�e�n�c�e�)�
�
� � � � �/�/� �=�>� �o�u�t�p�u�t�s� �s�t�r�i�n�g� �a�r�r�a�y�
�
�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�e�n�c�r�y�p�t�e�d�.�o�n�e�t�i�m�V�a�l�u�e�s�)�
�
� � � � �/�/� �=�>� �n�u�l�l� �o�r� �u�n�d�e�f�i�n�e�d�
�
���� �
�
��n�o�t�e�:�� �T�h�e� �f�i�r�s�t� �t�i�m�e� �y�o�u� �c�a�l�l� �t�h�i�s� �f�u�n�c�t�i�o�n� �i�t� �w�i�l�l� �c�r�e�a�t� �t�h�e� ��d�i�r�e�c�t�o�r�y�� �a�n�d� ��f�i�l�e��.� �A�f�t�e�r�w�a�r�d�s� �a�l�l� �t�h�e� �o�t�h�e�r� �a�t�t�e�m�p�t�s� �t�o� �e�n�c�r�y�p�t� �u�s�i�n�g� �v�a�r�i�a�b�l�e�s� ��s�t�o�r�a�g�e� �i�n� �m�e�m�o�r�y��
�
�w�i�l�l� �s�i�m�p�l�y� �r�e�a�d� �f�r�o�m� �t�h�i�s� �f�i�l�e�.�
�
�
�
��a�s�y�n�c�K�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�� �t�h�i�s� �m�e�t�h�o�d� �d�o�e�s� �e�v�e�r�y�t�h�i�n�g� �t�h�a�t� � ��k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�� �c�a�n� �d�o� �b�u�t� �i�s� �a�n� ��a�s�y�n�c�h�r�o�n�o�u�s�� �f�u�n�c�t�i�o�n�.� �W�e� �t�a�l�k�e�d� �h�o�w� �i�t� �w�a�s� �p�o�s�s�i�b�l�e� �t�o� �s�a�v�e� �t�h�e� ��e�n�c�r�y�p�t�i�o�n� �v�a�r�i�a�b�l�e�s��
�
�t�o� �a� �f�i�l�e�.� ��C�o�d�e�i�n�a�h�a�t�� �a�l�s�o� �s�u�p�p�o�r�t�s� �s�a�v�i�n�g� �t�h�e� ��e�n�c�r�y�p�t�i�o�n� �v�a�r�i�a�b�l�e�s�� �t�o� �a� � �[�M�o�n�g�o�D�B�]�(�h�t�t�p�s�:�/�/�w�w�w�.�m�o�n�g�o�d�b�.�c�o�m�)� �d�a�t�a�b�a�s�e�.� �I�f� �y�o�u� �s�e�t� �t�h�e� � ��o�n�t�i�m�e�p�a�d�� �w�h�i�c�h� �i�s� �t�h�e� �s�e�c�o�n�d� �p�a�r�a�m�a�t�e�r� �t�h�a�t�
�
��k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�� �a�n�d� ��a�s�y�n�c�K�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�� �t�a�k�e� �t�o� �f�a�l�s�e� �b�y� �t�h�e� �d�e�f�a�u�l�t� �i�t� �w�i�l�l� �s�a�v�e� �t�h�e� ��e�n�c�r�y�p�t�i�o�n� �v�a�r�i�a�l�e�s� �t�o� �a� �f�i�l�e��;� �H�o�w�e�v�e�r� ��b�o�t�h�� �t�h�i�s� �f�u�n�c�t�i�o�n� �a�l�s�o� �t�a�k�e� �a� �t�h�i�r�d� �p�a�r�a�m�e�t�e�r�
�
��s�t�o�r�a�g�e�M�e�t�h�o�d��.� �I�f� �y�o�u� �w�a�n�t� �t�o� �s�a�v�e� �a� �t�h�e� ��e�n�c�r�y�p�t�i�o�n�s� �v�a�r�i�a�b�l�e�s�� �t�o� �a� �f�i�l�e� �w�e� �r�e�c�o�m�e�n�d� �y�o�u� �s�i�m�p�l�e� �u�s�e� ��k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�� �a�n�d� �l�e�a�v�e� �t�h�e� �t�h�i�r�d� �p�a�r�a�m�e�t�e�r� ��s�t�o�r�a�g�e� �m�e�t�h�o�d�� �u�n�d�e�f�i�n�e�d�.� �H�o�w�e�v�e�r�,�\�
�
�i�f� �y�o�u� �w�a�n�t� �t�o� �s�a�v� �t�h�e� ��e�n�c�r�y�p�t�i�o�n� �v�a�r�i�a�b�l�e�s�� �t�o� �[�M�o�n�g�o�D�B�]�(�h�t�t�p�s�:�/�/�w�w�w�.�m�o�n�g�o�d�b�.�c�o�m�)� �d�a�t�a�b�a�s�e� �u�s�e� ��a�s�y�n�c�K�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�� �a�n�d� �p�a�s�s� �t�h�e� ��s�t�o�r�a�g�e� �m�e�t�h�o�d�� �s�p�e�c�i�f�y�i�n�g� �t�h�e� �v�a�l�u�e�s�.�
�
����j�s�
�
� � � � �/�/� �c�a�l�l� �t�h�e� �a�p�i�
�
� � � � �c�o�n�s�t� �c�o�d�e�h�a�t� �=� �r�e�q�u�i�r�e�(�'�@�c�o�d�e�i�n�a�h�a�r�/�c�r�y�p�t�o�'�)�;�
�
� � � � �
�
� � � � �/�/� �v�a�l�u�e� �t�o� �e�n�c�r�y�p�t�;�
�
� � � � �c�o�n�s�t� �p�h�r�a�s�e� �=� �'�J�u�m�p�i�n�g� �u�p� �a�n�d� �d�o�w�n� �c�o�m�e�s� �t�h�e� �d�i�n�a�s�o�u�r�'�;�
�
� � � � �/�/� �d�a�t�a�b�a�s�e� �c�o�n�n�e�c�t�i�o�n� �s�t�r�i�n�g�
�
� � � � �c�o�n�s�t� �c�o�n�n�e�c�t�i�o�n� �=� �'�m�o�n�g�o�d�b�:�/�/�1�2�7�.�0�.�0�.�1�:�2�7�0�1�7�/�?�r�e�a�d�P�r�e�f�e�r�e�n�c�e�=�p�r�i�m�a�r�y�&�s�s�l�=�f�a�l�s�e�'�;�
�
� � � � �/�/� �e�n�c�r�y�p�t�i�n�g� �a�n�d� �s�a�v�i�n�g� �t�h�e� �e�n�c�r�y�p�t�i�o�n� �v�a�r�i�a�b�l�e�s� �t�o� �a� �d�a�t�a�b�a�s�e�
�
� � � � �(�a�s�y�n�c� �(�)�=�>�{�
�
� � � � � � � � �/�/� �e�n�c�r�y�p�t�s�,� �s�a�v�e�s� �t�h�e� �e�n�c�r�y�p�t�i�o�n� �v�a�r�i�a�b�l�e�s� �t�o� �a� �d�a�t�a�b�a�s�e�,�
�
� � � � � � � � �/�/� �u�s�e�s� �d�e�f�a�u�l�t� �d�a�t�a�b�a�s�e� �n�a�m�e� �a�n�d� �d�e�f�a�u�l�t� �c�o�l�l�e�c�t�i�o�n� �n�a�m�e�.�
�
� � � � � � � � �/�/� �d�a�t�a�b�a�s�e�:� �e�n�c�r�y�p�t�i�o�n�
�
� � � � � � � � �/�/� �c�o�l�l�e�c�t�i�o�n�:� �k�e�y�s�
�
� � � � � � � � �c�o�n�s�t� �e�n�c�r�y�p�t�i�o�n�1� �=� �a�w�a�i�t� �c�o�d�e�h�a�t�.�C�r�y�p�t�o�.�a�s�y�n�c�K�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�(�p�h�r�a�s�e�,� �f�a�l�s�e�,� �{�
�
� � � � � � � � � � � � �m�e�t�h�o�d�:� �'�d�a�t�a�b�a�s�e�'�,� �
�
� � � � � � � � � � � � �c�o�n�n�e�c�t�i�o�n�S�t�r�i�n�g�:� �c�o�n�n�e�c�t�i�o�n�
�
� � � � � � � � �}�)�
�
�
�
� � � � � � � � �/�/� �e�n�c�r�y�p�t�s�,� �s�a�v�e�s� �t�h�e� �e�n�c�r�y�p�t�i�o�n� �v�a�r�i�a�b�l�e�s� �t�o� �a� �d�a�t�a�b�a�s�e�
�
� � � � � � � � �/�/� �o�n�l�y� �t�h�i�s� �t�i�m�e� �y�o�u� �s�p�e�c�i�f�y� �d�a�t�a�b�a�s�e� �a�n�d�/�o�r� �c�o�l�l�e�c�t�i�o�n� �n�a�m�e�
�
� � � � � � � � � �c�o�n�s�t� �e�n�c�r�y�p�t�i�o�n�2� �=� �a�w�a�i�t� �c�o�d�e�h�a�t�.�C�r�y�p�t�o�.�a�s�y�n�c�K�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�(�p�h�r�a�s�e�,� �f�a�l�s�e�,� �{�
�
� � � � � � � � � � � � �m�e�t�h�o�d�:� �'�d�a�t�a�b�a�s�e�'�,� �
�
� � � � � � � � � � � � �c�o�n�n�e�c�t�i�o�n�S�t�r�i�n�g�:� �c�o�n�n�e�c�t�i�o�n�,�
�
� � � � � � � � � � � � �d�a�t�a�b�a�s�e�:� �'�m�y�d�b�'�,�
�
� � � � � � � � � � � � �c�o�l�l�e�c�t�i�o�n�:� �'�m�y�c�o�l�l�e�c�t�i�o�n�'�
�
� � � � � � � � �}�)�;�
�
� � � � �}�)�(�)�;�
�
����
�
� �
�
��k�e�y�S�e�q�u�e�n�c�e�D�e�c�r�y�p�t�� �t�a�k�e�s� �a�n� ��a�r�r�a�y� �o�f� �n�u�m�b�e�r�s� �(�k�e�y�R�i�n�g�)�� �a�n�d� ��a�n� �a�r�r�a�y� �o�f� �c�h�a�r�a�c�t�e�r�s� �(�s�e�q�u�e�n�c�e�)��.� �I�t� �w�i�l�l� �t�a�k�e� ��a�n� �a�r�r�a�y� �o�f� �n�u�m�b�e�r�s� �(�o�n�e�t�i�m�e�V�a�l�u�e�s�)�� �i�f� �y�o�u� �d�i�d� �n�o�t� �u�s�e�
�
�t�h�e� �v�a�r�i�a�b�l�e�s� ��s�t�o�r�e�d� �i�n� �m�e�m�o�r�y��.� ��Y�o�u� �a�r�e� �r�e�s�p�o�n�s�i�b�e�l� �t�o� �s�t�o�r�e�d� �a�n�d� �m�a�i�n�t�a�i�n� �t�h�e� �o�n�e� �t�i�m�e� �v�a�l�u�e�s��.� �I�t� �r�e�t�u�r�n�s� �a� �d�e�c�r�y�p�t�e�d� �s�t�r�i�n�g� �o�f� �c�h�a�r�a�c�t�e�r�s�.�
�
�
�
��k�e�y�S�e�q�u�e�n�c�e�D�e�c�r�y�p�t�� �w�i�t�h� ��o�n�e�t�i�m�e�V�a�l�u�e�s��.�
�
����j�s�
�
� � � � �/�*�*�
�
� � � � � �*� �i�n�s�t�a�n�c�i�a�t�e� �a� �s�a�l�t� �o�b�j�e�c�t� �w�e� �a�r�e� �g�o�i�n�g� �t�o� �u�s�e�
�
� � � � � �*� �t�h�e� �k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t� �t�o� �e�n�c�r�y�p�t� �t�h�e� �s�a�l�t� �a�r�r� �r�e�s�u�l�t�
�
� � � � � �*� �*�/�
�
� � � � �c�o�n�s�t� �c�o�d�e�h�a�t� �=� �r�e�q�u�i�r�e�(�'�@�c�o�d�e�i�n�a�h�a�t�/�c�r�y�p�t�o�'�)�;�
�
� � � � �c�o�n�s�t� �s�a�l�t� �=� �n�e�w� �c�o�d�e�h�a�t�.�S�a�l�t�(�)�;�
�
�
�
� � � � �/�/� �g�e�n�e�r�a�t�e� �a� �s�a�l�t�
�
� � � � �c�o�n�s�t� �n�e�w�S�a�l�t� �=� �s�a�l�t�.�g�e�n�e�r�a�t�e�(�)�;�
�
�
�
� � � � �/�/� �e�n�c�r�y�p�t� �t�h�e� �r�e�s�u�l�t� �(�o�n�e�t�i�m�e�p�a�d� �m�o�d�e�)� �
�
� � � � �c�o�n�s�t� �e�n�c�r�y�p�t�e�d� �=� �c�o�d�e�h�a�t�.�C�r�y�p�t�o�.�k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�(�n�e�w�S�a�l�t�)�;�
�
�
�
� � � � �/�/� �d�e�c�r�y�p�t� �t�h�e� �r�e�s�u�l�t� �(�o�n�e�t�i�m�e�p�a�d� �m�o�d�e�)�
�
� � � � �c�o�n�s�t� �d�e�c�r�y�p�t�e�d� �=� �c�o�d�e�h�a�t�.�C�r�y�p�t�o�.�k�e�y�S�e�q�u�e�n�c�e�D�e�c�r�y�p�t�(�e�n�c�r�y�p�t�e�d�.�k�e�y�R�i�n�g�,� �e�n�c�r�y�p�t�i�o�n�.�s�e�q�u�e�n�c�e�,� �e�n�c�r�y�p�t�i�o�n�.�o�n�e�t�i�m�e�V�a�l�u�e�s�)�;�
�
�
�
� � � � �/�/� �r�e�t�u�r�n�s� �a� �d�e�c�r�y�p�t�e�d� �s�t�r�i�n�g� �o�f� �c�h�a�r�a�c�t�e�r�s�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�d�e�c�r�y�p�t�e�d�)�
�
����
�
�
�
��k�e�y�S�e�q�u�e�n�c�e�D�e�c�r�y�p�t�� �w�i�t�h� �v�a�r�i�a�b�l�e�s� ��s�t�o�r�e�d� �i�n� �m�e�m�o�r�y��.�
�
����j�s�
�
� � � � �/�*�*�
�
� � � � � �*� �i�n�s�t�a�n�c�i�a�t�e� �a� �s�a�l�t� �o�b�j�e�c�t� �w�e� �a�r�e� �g�o�i�n�g� �t�o� �u�s�e�
�
� � � � � �*� �t�h�e� �k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t� �t�o� �e�n�c�r�y�p�t� �t�h�e� �s�a�l�t� �a�r�r� �r�e�s�u�l�t�
�
� � � � � �*� �*�/�
�
� � � � �c�o�n�s�t� �c�o�d�e�h�a�t� �=� �r�e�q�u�i�r�e�(�'�@�c�o�d�e�i�n�a�h�a�t�/�c�r�y�p�t�o�'�)�;�
�
� � � � �c�o�n�s�t� �s�a�l�t� �=� �n�e�w� �c�o�d�e�h�a�t�.�S�a�l�t�(�)�;�
�
�
�
� � � � �/�/� �g�e�n�e�r�a�t�e� �a� �s�a�l�t�
�
� � � � �c�o�n�s�t� �n�e�w�S�a�l�t� �=� �s�a�l�t�.�g�e�n�e�r�a�t�e�(�)�;�
�
�
�
� � � � �/�/� �e�n�c�r�y�p�t� �t�h�e� �r�e�s�u�l�t� �(�v�a�r�i�a�b�l�e�s� �s�t�o�r�e�d� �i�n� �m�e�m�o�r�y� �m�o�d�e�)� �
�
� � � � �c�o�n�s�t� �e�n�c�r�y�p�t�e�d� �=� �c�o�d�e�h�a�t�.�C�r�y�p�t�o�.�k�e�y�S�e�q�u�e�n�c�e�E�n�c�r�y�p�t�(�n�e�w�S�a�l�t�,� �f�a�l�s�e�)�;�
�
�
�
� � � � �/�/� �d�e�c�r�y�p�t� �t�h�e� �r�e�s�u�l�t� �(�v�a�r�i�a�b�l�e�s� �s�t�o�r�e�d� �i�n� �m�e�m�o�r�y� �m�o�d�e�)�
�
� � � � �c�o�n�s�t� �d�e�c�r�y�p�t�e�d� �=� �c�o�d�e�h�a�t�.�C�r�y�p�t�o�.�k�e�y�S�e�q�u�e�n�c�e�D�e�c�r�y�p�t�(�e�n�c�r�y�p�t�e�d�.�k�e�y�R�i�n�g�,� �e�n�c�r�y�p�t�i�o�n�.�s�e�q�u�e�n�c�e�)�;�
�
�
�
� � � � �/�/� �r�e�t�u�r�n�s� �a� �d�e�c�r�y�p�t�e�d� �s�t�r�i�n�g� �o�f� �c�h�a�r�a�c�t�e�r�s�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�d�e�c�r�y�p�t�e�d�)�
�
����
�
��n�o�t�e�:�� �W�i�t�h� �v�a�r�i�a�b�l�e�s� �s�t�o�r�e�d� �i�n� �m�e�m�o�r�y� �t�h�e� ��m�o�d�u�l�e�� �t�a�k�e�s� �o�n� �t�h�e� �r�e�s�p�o�n�s�a�b�i�l�i�t�y� �o�f� �s�t�o�r�i�n�g� �a�n�d� �m�a�n�t�a�i�n�i�n�g� �t�h�i�s� �v�a�r�i�a�b�l�e�s�.�
�
�I�s� �u�p� �t�o� �t�h�e� �u�s�e�r� �w�h�i�c�h� �v�e�r�s�i�o�n� �t�o� �u�s�e�.�
�
�
�
��a�s�y�n�c�K�e�y�S�e�q�u�e�n�c�e�D�e�c�r�y�p�t�� �i�s� �t�w�i�n� �t�o� ��k�e�y�S�e�q�u�e�n�c�e�D�e�c�r�y�p�t�� �w�i�t�h� �t�h�e� �e�x�c�e�p�t�i�o�n� �t�h�a�t� �i�t� �i�s� �a�n� ��a�s�y�n�c�h�r�o�n�o�u�s�� �m�e�t�h�o�d�.� �T�h�i�s� �m�e�t�h�o�d� �m�u�s�t� �b�e� �u�s�e�
�
�w�h�e�n� �d�e�c�r�y�p�t�i�n�g� �u�s�i�n�g� ��e�q�u�a�t�i�o�n� �v�a�r�i�a�b�l�e�s�� �s�t�o�r�e�d� �i�n� �a� �[�M�o�n�g�o�D�B�]�(�h�t�t�p�s�:�/�/�w�w�w�.�m�o�n�g�o�d�b�.�c�o�m�)� �d�a�t�a�b�a�s�e�,� �a�l�t�h�o�u�h�g� �i�t� �c�a�n� �a�l�s�o� �b�e� �u�s�e�d� �w�h�e�n� �
�
��e�q�u�a�t�i�o�n� �v�a�r�i�a�b�l�e�s�� �a�r�e� �s�t�o�r�e�d� �i�n� �a� �f�i�l�e� �o�r� �f�o�r� ��o�n�e�t�i�m�e�p�a�d�� �v�a�l�u�e�s� �i�t�'�s� �r�e�a�l� �p�u�r�p�o�s�e� �i�s� �t�o� �r�u�n� �w�h�e�n� �i�n� �n�e�e�d� �o�f� ��d�a�t�a�b�a�s�e�� �s�t�o�r�a�g�e� �s�i�n�c�e�
�
��f�i�l�e� �s�t�o�r�a�g�e�d�� �a�n�d� ��o�n�e�t�i�m�e�p�a�d�� �c�a�n� �b�e� �d�e�c�r�y�p�t�e�d� �w�i�t�h� ��k�e�y�S�e�q�u�e�n�c�e�D�e�c�r�y�p�t��.�
�
����j�s�
�
� � � � �/�/� �c�l�a�s�s� �t�h�e� �a�p�i�
�
� � � � �c�o�n�s�t� �c�o�d�e�h�a�t� �=� �r�e�q�u�i�r�e�(�'�@�c�o�d�e�i�n�a�h�a�t�/�c�r�y�p�t�o�'�)�;�
�
�
�
� � � � �/�/� �l�e�t�s� �s�a�y� �t�h�e� �e�n�c�r�y�p�t�e�d� �v�a�l�u�e� �i�s� �s�t�o�r�e�d� �i�n� �a� �c�o�o�k�i�e�
�
� � � � �c�o�n�s�t� �e�n�c�r�y�p�t�i�o�n� �=� �r�e�q�.�c�o�o�k�i�e�s�[�'�u�s�e�r�-�t�a�g�'�]�;�
�
� � � � � �/�/� �v�a�l�u�e� �t�o� �d�e�c�r�y�p�t�;�
�
� � � � �c�o�n�s�t� �p�h�r�a�s�e� �=� �'�J�u�m�p�i�n�g� �u�p� �a�n�d� �d�o�w�n� �c�o�m�e�s� �t�h�e� �d�i�n�a�s�o�u�r�'�;�
�
� � � � �/�/� �d�a�t�a�b�a�s�e� �c�o�n�n�e�c�t�i�o�n� �s�t�r�i�n�g�
�
� � � � �c�o�n�s�t� �c�o�n�n�e�c�t�i�o�n� �=� �'�m�o�n�g�o�d�b�:�/�/�1�2�7�.�0�.�0�.�1�:�2�7�0�1�7�/�?�r�e�a�d�P�r�e�f�e�r�e�n�c�e�=�p�r�i�m�a�r�y�&�s�s�l�=�f�a�l�s�e�'�;�
�
� � � � �/�/� �d�e�c�r�y�p�t�i�n�g� �
�
� � � � �(�a�s�y�n�c� �(�)�=�>�{�
�
� � � � � � � � �/�/� �u�s�e�s� �d�e�f�a�u�l�t� �d�a�t�a�b�a�s�e� �n�a�m�e� �a�n�d� �d�e�f�a�u�l�t� �c�o�l�l�e�c�t�i�o�n� �n�a�m�e�.�
�
� � � � � � � � �/�/� �d�a�t�a�b�a�s�e�:� �e�n�c�r�y�p�t�i�o�n�
�
� � � � � � � � �/�/� �c�o�l�l�e�c�t�i�o�n�:� �k�e�y�s�
�
� � � � � � � � �c�o�n�s�t� �d�e�c�r�y�p�t�i�o�n�1� �=� �a�w�a�i�t� �c�o�d�e�h�a�t�.�C�r�y�p�t�o�.�a�s�y�n�c�S�e�q�u�e�n�c�e�D�e�c�r�y�p�(�e�n�c�r�y�p�t�i�o�n�.�k�e�y�R�i�n�g�,� �e�n�c�r�y�p�t�i�o�n�.�s�e�q�u�e�n�c�e�,� �u�n�d�e�f�i�n�e�d�,� �{�
�
� � � � � � � � � � � � �m�e�t�h�o�d�:� �'�d�a�t�a�b�a�s�e�'�,� �
�
� � � � � � � � � � � � �c�o�n�n�e�c�t�i�o�n�S�t�r�i�n�g�:� �c�o�n�n�e�c�t�i�o�n�
�
� � � � � � � � �}�)�
�
�
�
� � � � � � � � �/�/� �t�h�i�s� �t�i�m�e� �y�o�u� �s�p�e�c�i�f�y� �d�a�t�a�b�a�s�e� �a�n�d�/�o�r� �c�o�l�l�e�c�t�i�o�n� �n�a�m�e�
�
� � � � � � � � � �c�o�n�s�t� �d�e�c�r�y�p�t�i�o�n�2� �=� �a�w�a�i�t� �c�o�d�e�h�a�t�.�C�r�y�p�t�o�.�a�s�y�n�c�S�e�q�u�e�n�c�e�D�e�c�r�y�p�(�e�n�c�r�y�p�t�i�o�n�.�k�e�y�R�i�n�g�,� �e�n�c�r�y�p�t�i�o�n�.�s�e�q�u�e�n�c�e�,� �u�n�d�e�f�i�n�e�d�,� �{�
�
� � � � � � � � � � � � �m�e�t�h�o�d�:� �'�d�a�t�a�b�a�s�e�'�,� �
�
� � � � � � � � � � � � �c�o�n�n�e�c�t�i�o�n�S�t�r�i�n�g�:� �c�o�n�n�e�c�t�i�o�n�,�
�
� � � � � � � � � � � � �d�a�t�a�b�a�s�e�:� �'�m�y�d�b�'�,�
�
� � � � � � � � � � � � �c�o�l�l�e�c�t�i�o�n�:� �'�m�y�c�o�l�l�e�c�t�i�o�n�'�
�
� � � � � � � � �}�)�;�
�
� � � � �}�)�(�)�;�
�
���� � �
�
�
�
��d�e�l�e�t�e�K�e�y�S�e�q�u�e�n�c�e�F�i�l�e�S�t�o�r�a�g�e�� �t�h�i�s� �w�i�l�l� �d�e�l�e�t�e� �t�h�e� ��f�i�l�e�� �w�h�e�r�e� �t�h�e� �v�a�r�i�a�b�l�e�s� �a�r�e� �s�t�o�r�e�d�.�
�
����j�s�
�
� � � � �/�/� �c�a�l�l� �t�h�e� �a�p�i� �
�
� � � � �c�o�n�s�t� �c�o�d�e�h�a�t� �=� �r�e�q�u�i�r�e�(�'�@�c�o�d�e�i�n�a�h�a�t�/�c�r�y�p�t�o�'�)�;�
�
�
�
� � � � �/�/� �d�e�l�e�t�e�s� �f�i�l�e�s�
�
� � � � �c�o�d�e�h�a�t�.�C�r�y�p�t�o�.�d�e�l�e�t�e�K�e�y�S�e�q�u�e�n�c�e�F�i�l�e�S�t�o�r�a�g�e�(�)�;�
�
� � � � �/�/� �r�e�t�u�r�n�s� �=�>� �a� �t�r�u�e� �o�r� �f�a�l�s�e�
�
����
�
�
�
��d�e�l�e�t�e�K�e�y�D�i�r�� �t�h�i�s� �w�i�l�l� �d�e�l�e�t�e� �t�h�e� ��d�i�r�e�c�t�o�r�y�� �w�h�e�r�e� �t�h�e� ��k�e�y� �f�i�l�e�s�� �a�r�e� �s�a�v�e�s�.�
�
��n�o�t�e�:�� �Y�o�u� �m�u�s�t� �d�e�l�e�t�e� �a�l�l� ��f�i�l�e�s�� �b�e�f�o�r�e� �d�e�l�e�t�i�n�g� �t�h�e� ��d�i�r�e�c�t�o�r�y��.�
�
����j�s�
�
� � � � �/�/� �c�a�l�l� �t�h�e� �a�p�i� �
�
� � � � �c�o�n�s�t� �c�o�d�e�h�a�t� �=� �r�e�q�u�i�r�e�(�'�@�c�o�d�e�i�n�a�h�a�t�/�c�r�y�p�t�o�'�)�;�
�
�
�
� � � � �/�/� �d�e�l�e�t�e�s� �f�i�l�e�s�
�
� � � � �c�o�d�e�h�a�t�.�C�r�y�p�t�o�.�d�e�l�e�t�e�K�e�y�D�i�r�(�)�;�
�
� � � � �/�/� �r�e�t�u�r�n�s� �=�>� �a� �t�r�u�e� �o�r� �f�a�l�s�e�
�
����
�
�
�
�#�#� �U�t�i�l�i�t�i�e�s�
�
�
�
�U�t�i�l�i�t�i�e�s� �i�s� �a� �s�i�m�p�l�e� �c�l�a�s�s� �t�h�a�t� �h�a�s� �o�n�e� ��s�t�a�t�i�c�� �m�e�t�h�o�d�.� ��c�h�a�r�a�c�t�e�r�N�u�m�b�e�r�� �i�t� �t�a�k�e�s� �a� �n�u�m�b�e�r� �a�s� �a�r�g�u�m�e�n�t� �a�n�d� �i�t� �r�e�t�u�r�n�s� �t�h�e� �c�h�a�r�a�c�t�e�r� �v�a�l�u�e� �o�f� �t�h�a�t� �n�u�m�b�e�r� �o�r� �t�h�e� �n�u�m�b�e�r� �i�t�s�e�l�f�.� �T�h�i�s� �d�e�c�i�t�i�o�n� �i�s�
�
�m�a�d�e� �a�t� �r�a�n�d�o�m�.�
�
����j�s�
�
� � � � �/�/� �c�a�l�l� �t�h�e� �A�P�I�
�
� � � � �c�o�n�s�t� �c�o�d�e�h�a�t� �=� �r�e�q�u�i�r�e�(�'�@�c�o�d�e�i�n�a�h�a�t�/�c�r�y�p�t�o�'�)�;�
�
�
�
� � � � �/�/� �c�a�l�l� �t�h�e� �m�e�t�h�o�d�
�
� � � � �c�o�n�s�t� �r�e�s�u�l�t� �=� �c�o�d�e�h�a�t�.�U�t�i�l�i�t�i�e�s�.�c�h�a�r�a�c�t�e�r�N�u�m�b�e�r�(�5�)�;�
�
�
�
� � � � �c�o�n�s�o�l�e�.�l�o�g�(�r�e�s�u�l�t�)�;�
�
� � � � �/�/� �=�>� �p�r�i�n�t�s� �t�h�e� �n�u�m�b�e�r� �5� �o�r� �f�
�
����
�
�
�
�
�
�#� �M�O�R�E� �C�O�M�I�N�G� �S�O�O�N� �:�-�)�
�
�
