Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ObjToHashAlgId()

static int Internal.NativeCrypto.CapiHelper.ObjToHashAlgId ( object hashAlg)
inlinestatic

Definition at line 1053 of file CapiHelper.cs.

1054 {
1055 if (hashAlg == null)
1056 {
1057 throw new ArgumentNullException("hashAlg");
1058 }
1059 if (hashAlg is string nameOrOid)
1060 {
1061 return NameOrOidToHashAlgId(nameOrOid, OidGroup.HashAlgorithm);
1062 }
1063 if (hashAlg is HashAlgorithm)
1064 {
1065 if (hashAlg is MD5)
1066 {
1067 return 32771;
1068 }
1069 if (hashAlg is SHA1)
1070 {
1071 return 32772;
1072 }
1073 if (hashAlg is SHA256)
1074 {
1075 return 32780;
1076 }
1077 if (hashAlg is SHA384)
1078 {
1079 return 32781;
1080 }
1081 if (hashAlg is SHA512)
1082 {
1083 return 32782;
1084 }
1085 }
1086 else if (hashAlg is Type c)
1087 {
1088 if (typeof(MD5).IsAssignableFrom(c))
1089 {
1090 return 32771;
1091 }
1092 if (typeof(SHA1).IsAssignableFrom(c))
1093 {
1094 return 32772;
1095 }
1096 if (typeof(SHA256).IsAssignableFrom(c))
1097 {
1098 return 32780;
1099 }
1100 if (typeof(SHA384).IsAssignableFrom(c))
1101 {
1102 return 32781;
1103 }
1104 if (typeof(SHA512).IsAssignableFrom(c))
1105 {
1106 return 32782;
1107 }
1108 }
1109 throw new ArgumentException(System.SR.Argument_InvalidValue, "hashAlg");
1110 }
static int NameOrOidToHashAlgId(string nameOrOid, OidGroup oidGroup)
static string Argument_InvalidValue
Definition SR.cs:24
Definition SR.cs:7

References System.SR.Argument_InvalidValue, and Internal.NativeCrypto.CapiHelper.NameOrOidToHashAlgId().

Referenced by Internal.NativeCrypto.CapiHelper.ObjToHashAlgorithm(), System.Security.Cryptography.RSACryptoServiceProvider.SignData(), System.Security.Cryptography.RSACryptoServiceProvider.SignData(), System.Security.Cryptography.RSACryptoServiceProvider.SignData(), and System.Security.Cryptography.RSACryptoServiceProvider.VerifyData().