コード例 #1
0
        // Перегруженная функция для файлового режима
        public static string Get_HMAC_SHA3_Hash(FileStream fs, string NameSHA, string Key)
        {
            switch (NameSHA)
            {
            case "SHA3-512":
                return(SHA3.SHA3_HMAC_512(fs, Key));

            case "SHA3-384":
                return(SHA3.SHA3_HMAC_384(fs, Key));

            case "SHA3-256":
                return(SHA3.SHA3_HMAC_256(fs, Key));

            case "SHA3-224":
                return(SHA3.SHA3_HMAC_224(fs, Key));
            }
            return("Error!");
        }
コード例 #2
0
        public static string Get_HMAC_SHA3_Hash(string Text, string NameSHA, bool Is_Text_Input, string Key)
        {
            if (Is_Text_Input)      // если текстовая строка
            {
                switch (NameSHA)
                {
                case "SHA3-512":
                    return(SHA3.SHA3_HMAC_512(Text, Key));

                case "SHA3-384":
                    return(SHA3.SHA3_HMAC_384(Text, Key));

                case "SHA3-256":
                    return(SHA3.SHA3_HMAC_256(Text, Key));

                case "SHA3-224":
                    return(SHA3.SHA3_HMAC_224(Text, Key));
                }
            }
            else                    // если 16-ричная строка
            {
                switch (NameSHA)
                {
                case "SHA3-512":
                    return(SHA3.SHA3_HMAC_512_HEX(Text, Key));

                case "SHA3-384":
                    return(SHA3.SHA3_HMAC_384_HEX(Text, Key));

                case "SHA3-256":
                    return(SHA3.SHA3_HMAC_256_HEX(Text, Key));

                case "SHA3-224":
                    return(SHA3.SHA3_HMAC_224_HEX(Text, Key));
                }
            }
            return("Error!");
        }