
    Mg$                     b    S SK J r Jr  S SKrS SKr\" S5      \ " S5      S\SS4S j5       5       rg)    )plugincompleteNhashsreturnc                    S nS nU R                  S5      R                  5       nU R                  S5      R                  5       n [        [        U5      nUS:X  a,  U R                  S5      nU R                  S	U" Xv5      -   5        gUS
:X  a,  U R                  S5      nU R                  S	U" X5      -   5        gU R                  S5        g! [         a    U R                  SU 35         gf = f)z
Hashes a given string or file using the specified hash function.

Parameters:
jarvis (obj): Jarvis assistant object
s (str): Not used in this function

Returns:
None

Example Usage:
hash
c                 n    U" 5       nUR                  U R                  5       5        UR                  5       $ )N)updateencode	hexdigest)
user_input	hash_funchs      :/Users/admin/workspace/ai/Jarvis/jarviscli/plugins/hash.pyhash_stringhash_data.<locals>.hash_string   s*    K	""$%{{}    c                    ^ U" 5       n [        U S5       m[        U4S jS5       H  nUR                  U5        M     S S S 5        UR                  5       $ ! , (       d  f       N= f! [         a     gf = f)Nrbc                  &   > T R                  S5      $ )Ni   )read)files   r   <lambda>.hash_data.<locals>.hash_file.<locals>.<lambda>    s    $))D/r   r   z&Error: File not found or inaccessible.)openiterr
   r   IOError)	file_pathr   r   chunkr   s       @r   	hash_filehash_data.<locals>.hash_file   sh    K	<i&$!"93?EHHUO @ ' ;;=  '&  	<;	<s'   A( )AA( 
A%!A( (
A54A5zDDo you want to hash a string or a file? (Enter 'string' or 'file'): z3Enter the hash function (md5, sha1, sha256, etc.): zInvalid hash function: NstringzEnter the string to hash: zHashed result: r   zEnter the path to the file: z4Invalid input type. Please enter 'string' or 'file'.)inputlowergetattrhashlibAttributeErrorsay)	jarvisr   r   r    
input_typehash_functionr   r   r   s	            r   	hash_datar,      s    "
<  = >>Ceg  LL "? @@E G]3	 X\\">?


${:'IIJ	v	LL!?@	

$y'FFG

IJ  

,]O<=s   C C-,C-)r   r   r&   osstrr,    r   r   <module>r0      sE    #  	 
&4K 4K 4K  4Kr   