





import argparse
import hashlib  # hashlib is only used inside the Test class
import struct







class      lowerCamelCase:
     '''simple docstring'''


     def __init__(    self				,     snake_case_							):
         _A     =							data
         _A     =							[0X6745_2301, 0XEFCD_AB89, 0X98BA_DCFE, 0X1032_5476, 0XC3D2_E1F0]




     @staticmethod
     def        lowerCAmelCase__		(    snake_case_				,     snake_case_							):
         return ((n << b) | (n >> (32 - b))) & 0XFFFF_FFFF




     def        lowerCAmelCase__		(    self							):
         _A     =							B'\x80' + B'\x00' * (63 - (len(self.data							) + 8) % 64)
         _A     =							self.data + padding + struct.pack('>Q'				,     8 * len(self.data							)							)
         return padded_data




     def        lowerCAmelCase__		(    self							):
         return [
             self.padded_data[i : i + 64] for i in range(0				,     len(self.padded_data							)				,     64							)
         ]




     def        lowerCAmelCase__		(    self				,     snake_case_							):
         _A     =							list(struct.unpack('>16L'				,     snake_case_							)							) + [0] * 64
         for i in range(16				,     80							):
             _A     =							self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16])				,     1							)
         return w




     def        lowerCAmelCase__		(    self							):
         _A     =							self.padding()
         _A     =							self.split_blocks()
         for block in self.blocks:
             _A     =							self.expand_block(snake_case_							)
             _A,			_A,			_A,			_A,			_A     =							self.h
             for i in range(0				,     80							):
                 if 0 <= i < 20:
                     _A     =							(b & c) | ((~b) & d)
                     _A     =							0X5A82_7999
                 elif 20 <= i < 40:
                     _A     =							b ^ c ^ d
                     _A     =							0X6ED9_EBA1
                 elif 40 <= i < 60:
                     _A     =							(b & c) | (b & d) | (c & d)
                     _A     =							0X8F1B_BCDC
                 elif 60 <= i < 80:
                     _A     =							b ^ c ^ d
                     _A     =							0XCA62_C1D6
                 _A,			_A,			_A,			_A,			_A     =							(
                     self.rotate(snake_case_				,     5							) + f + e + k + expanded_block[i] & 0XFFFF_FFFF,
                     a,
                     self.rotate(snake_case_				,     30							),
                     c,
                     d,
                 )
             _A     =							(
                 self.h[0] + a & 0XFFFF_FFFF,
                 self.h[1] + b & 0XFFFF_FFFF,
                 self.h[2] + c & 0XFFFF_FFFF,
                 self.h[3] + d & 0XFFFF_FFFF,
                 self.h[4] + e & 0XFFFF_FFFF,
             )
         return ("{:08x}" * 5).format(*self.h							)





def 				__lowerCAmelCase(       )							-> Any:




    """simple docstring"""




    _A     =							b'Test String'
    assert SHAaHash(_SCREAMING_SNAKE_CASE				).final_hash() == hashlib.shaa(_SCREAMING_SNAKE_CASE				).hexdigest()  # noqa: S324





def 				__lowerCAmelCase(       )							-> int:




    """simple docstring"""




    _A     =							argparse.ArgumentParser(description='Process some strings or files'				)
    parser.add_argument(
        '--string'							,     dest='input_string'							,     default='Hello World!! Welcome to Cryptography'							,     help='Hash the string'							,     )
    parser.add_argument('--file'							,     dest='input_file'							,     help='Hash contents of a file'				)
    _A     =							parser.parse_args()
    _A     =							args.input_string
    # In any case hash input should be a bytestring
    if args.input_file:
        with open(args.input_file							,     'rb'				) as f:
            _A     =							f.read()
    else:
        _A     =							bytes(_SCREAMING_SNAKE_CASE							,     'utf-8'				)
    print(SHAaHash(_SCREAMING_SNAKE_CASE				).final_hash()				)


if __name__ == "__main__":
 main()
 import doctest

 doctest.testmod()










'''simple docstring'''





from sklearn.metrics import mean_squared_error

import datasets


SCREAMING_SNAKE_CASE__          =  "\\n@article{scikit-learn,\n title={Scikit-learn: Machine Learning in {P}ython},\n author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.\n         and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhofer, P.\n         and Weiss, R. and Dubourg, V. and Vanderplas, J. and Passos, A. and\n         Cournapeau, D. and Brucher, M. and Perrot, M. and Duchesnay, E.},\n journal={Journal of Machine Learning Research},\n volume={12},\n pages={2825--2830},\n year={2011}\n}\n"

SCREAMING_SNAKE_CASE__          =  "\\nMean Squared Error(MSE) is the average of the square of difference between the predicted\nand actual values.\n"


SCREAMING_SNAKE_CASE__          =  "\nArgs:\n    predictions: array-like of shape (n_samples,) or (n_samples, n_outputs)\n        Estimated target values.\n    references: array-like of shape (n_samples,) or (n_samples, n_outputs)\n        Ground truth (correct) target values.\n    sample_weight: array-like of shape (n_samples,), default=None\n        Sample weights.\n    multioutput: {\"raw_values\", \"uniform_average\"} or array-like of shape (n_outputs,), default=\"uniform_average\"\n        Defines aggregating of multiple output values. Array-like value defines weights used to average errors.\n\n        \"raw_values\" : Returns a full set of errors in case of multioutput input.\n\n        \"uniform_average\" : Errors of all outputs are averaged with uniform weight.\n\n    squared : bool, default=True\n        If True returns MSE value, if False returns RMSE (Root Mean Squared Error) value.\n\nReturns:\n    mse : mean squared error.\nExamples:\n\n    >>> mse_metric = datasets.load_metric(\"mse\")\n    >>> predictions = [2.5, 0.0, 2, 8]\n    >>> references = [3, -0.5, 2, 7]\n    >>> results = mse_metric.compute(predictions=predictions, references=references)\n    >>> print(results)\n    {'mse': 0.375}\n    >>> rmse_result = mse_metric.compute(predictions=predictions, references=references, squared=False)\n    >>> print(rmse_result)\n    {'mse': 0.6123724356957945}\n\n    If you're using multi-dimensional lists, then set the config as follows :\n\n    >>> mse_metric = datasets.load_metric(\"mse\", \"multilist\")\n    >>> predictions = [[0.5, 1], [-1, 1], [7, -6]]\n    >>> references = [[0, 2], [-1, 2], [8, -5]]\n    >>> results = mse_metric.compute(predictions=predictions, references=references)\n    >>> print(results)\n    {'mse': 0.7083333333333334}\n    >>> results = mse_metric.compute(predictions=predictions, references=references, multioutput='raw_values')\n    >>> print(results) # doctest: +NORMALIZE_WHITESPACE\n    {'mse': array([0.41666667, 1. ])}\n"


@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION		,   _KWARGS_DESCRIPTION )
class 					snake_case			(datasets.Metric ):



       def 				_a   (					self   )	->				Optional[int]:
           return datasets.MetricInfo(
               description=_DESCRIPTION  ,citation=_CITATION  ,inputs_description=_KWARGS_DESCRIPTION  ,features=datasets.Features(self._get_feature_types()   )  ,reference_urls=[
                   "https://scikit-learn.org/stable/modules/generated/sklearn.metrics.mean_squared_error.html"
               ]  ,)



       def 				_a   (					self   )	->				Tuple:
           if self.config_name == "multilist":
               return {
                   "predictions": datasets.Sequence(datasets.Value("float"   )   ),
                   "references": datasets.Sequence(datasets.Value("float"   )   ),
               }
           else:
               return {
                   "predictions": datasets.Value("float"   ),
                   "references": datasets.Value("float"   ),
               }







       def 				_a   (					self  ,UpperCAmelCase_  ,UpperCAmelCase_  ,UpperCAmelCase_=None  ,UpperCAmelCase_="uniform_average"  ,UpperCAmelCase_=True   )	->				Tuple:
           lowercase__									=    mean_squared_error(
               UpperCAmelCase_  ,UpperCAmelCase_  ,sample_weight=UpperCAmelCase_  ,multioutput=UpperCAmelCase_  ,squared=UpperCAmelCase_   )

           return {"mse": mse}




