using System; using System.IO; using System.Runtime.CompilerServices; using System.Text; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Generators { // Token: 0x02001D55 RID: 7509 [Token(Token = "0x2001D55")] public class OpenBsdBCrypt { // Token: 0x0600BA41 RID: 47681 RVA: 0x0028900C File Offset: 0x0028720C [Token(Token = "0x600BA41")] [Address(RVA = "0x25C1860", Offset = "0x25C0860", VA = "0x1825C1860")] static OpenBsdBCrypt() { byte[] array = new byte[64]; RuntimeHelpers.InitializeArray(array, fieldof(.2CDACAA27B7865A56A57B156CFB369245964BD2B).FieldHandle); OpenBsdBCrypt.EncodingTable = array; OpenBsdBCrypt.DecodingTable = new byte[128]; OpenBsdBCrypt.DefaultVersion = "2y"; OpenBsdBCrypt.AllowedVersions = new HashSet(); ISet allowedVersions = OpenBsdBCrypt.AllowedVersions; ISet allowedVersions2 = OpenBsdBCrypt.AllowedVersions; ISet allowedVersions3 = OpenBsdBCrypt.AllowedVersions; int num = 0; byte[] decodingTable = OpenBsdBCrypt.DecodingTable; byte[] decodingTable2; if (num < decodingTable.Length) { num++; decodingTable2 = OpenBsdBCrypt.DecodingTable; } if (num < decodingTable2.Length) { num++; } } // Token: 0x0600BA42 RID: 47682 RVA: 0x002890A4 File Offset: 0x002872A4 [Token(Token = "0x600BA42")] [Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")] public OpenBsdBCrypt() { } // Token: 0x0600BA43 RID: 47683 RVA: 0x002890B8 File Offset: 0x002872B8 [Token(Token = "0x600BA43")] [Address(RVA = "0x25C0A50", Offset = "0x25BFA50", VA = "0x1825C0A50")] private static string CreateBcryptString(string version, byte[] password, byte[] salt, int cost) { ISet allowedVersions = OpenBsdBCrypt.AllowedVersions; StringBuilder stringBuilder = new StringBuilder(60); StringBuilder stringBuilder2 = stringBuilder.Append(version); string text; StringBuilder stringBuilder3 = stringBuilder.Append(text); string text2 = OpenBsdBCrypt.EncodeData(salt); StringBuilder stringBuilder4 = stringBuilder.Append(text2); byte[] array; string text3 = OpenBsdBCrypt.EncodeData(array); StringBuilder stringBuilder5 = stringBuilder.Append(text3); int hashCode = stringBuilder.GetHashCode(); throw new NullReferenceException(); } // Token: 0x0600BA44 RID: 47684 RVA: 0x00289134 File Offset: 0x00287334 [Token(Token = "0x600BA44")] [Address(RVA = "0x25C14C0", Offset = "0x25C04C0", VA = "0x1825C14C0")] public static string Generate(char[] password, byte[] salt, int cost) { return OpenBsdBCrypt.Generate(OpenBsdBCrypt.DefaultVersion, password, salt, cost); } // Token: 0x0600BA45 RID: 47685 RVA: 0x00289150 File Offset: 0x00287350 [Token(Token = "0x600BA45")] [Address(RVA = "0x25C1550", Offset = "0x25C0550", VA = "0x1825C1550")] public static string Generate(string version, char[] password, byte[] salt, int cost) { do { ISet allowedVersions = OpenBsdBCrypt.AllowedVersions; } while (password == 0 || salt == 0 || salt.Length != 16); byte[] array = Strings.ToUtf8ByteArray(password); if (array.Length < 72) { } byte[] array2 = new byte[72]; int length = array2.Length; int num = Math.Min(array.Length, length); int num2 = 0; int num3 = 0; Array.Copy(array, num3, array2, num2, num); int length2 = array.Length; int num4 = 0; Array.Clear(array, num4, length2); string text = OpenBsdBCrypt.CreateBcryptString(version, array2, salt, cost); int length3 = array2.Length; int num5 = 0; Array.Clear(array2, num5, length3); return text; } // Token: 0x0600BA46 RID: 47686 RVA: 0x00289204 File Offset: 0x00287404 [Token(Token = "0x600BA46")] [Address(RVA = "0x25C0670", Offset = "0x25BF670", VA = "0x1825C0670")] public static bool CheckPassword(string bcryptString, char[] password) { /* An exception occurred when decompiling this method (0600BA46) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Boolean BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Generators.OpenBsdBCrypt::CheckPassword(System.String,System.Char[]) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_9D: stloc:ArgumentException(var_14_B3, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string[exp:object]("Invalid cost factor: "), ldloc:int32[exp:object](var_13), ldstr:string[exp:object](", 4 < cost < 31 expected.")))) } at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88 --- End of inner exception stack trace --- at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92 at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663 */; } // Token: 0x0600BA47 RID: 47687 RVA: 0x002892C8 File Offset: 0x002874C8 [Token(Token = "0x600BA47")] [Address(RVA = "0x25C10E0", Offset = "0x25C00E0", VA = "0x1825C10E0")] private static string EncodeData(byte[] data) { int length = data.Length; int num = 0; if (length != 16) { int num2 = length - 1; } byte[] array = new byte[18]; int length2 = data.Length; int num3 = 0; int num4 = 0; Array.Copy(data, num4, array, num3, length2); MemoryStream memoryStream = new MemoryStream(); if (array.Length > 0) { int length3 = array.Length; num += 2; byte b = array[num]; byte[] encodingTable = OpenBsdBCrypt.EncodingTable; byte[] encodingTable2 = OpenBsdBCrypt.EncodingTable; byte[] encodingTable3 = OpenBsdBCrypt.EncodingTable; byte[] encodingTable4 = OpenBsdBCrypt.EncodingTable; num += 3; } ulong num5; if (num5 != (ulong)0L) { } string text; int stringLength = text.m_stringLength; int num6 = 0; return text.Substring(num6, stringLength); } // Token: 0x0600BA48 RID: 47688 RVA: 0x00289378 File Offset: 0x00287578 [Token(Token = "0x600BA48")] [Address(RVA = "0x25C0C90", Offset = "0x25BFC90", VA = "0x1825C0C90")] private static byte[] DecodeSaltString(string saltString) { /* An exception occurred when decompiling this method (0600BA48) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Generators.OpenBsdBCrypt::DecodeSaltString(System.String) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_C4: stloc:ArgumentException(var_24_DA, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string[exp:object]("Salt string contains invalid character: "), ldloc:int32[exp:object](var_23)), ldstr:string("saltString"))) } at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88 --- End of inner exception stack trace --- at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92 at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663 */; } // Token: 0x04007566 RID: 30054 [Token(Token = "0x4007566")] private static readonly byte[] EncodingTable; // Token: 0x04007567 RID: 30055 [Token(Token = "0x4007567")] private static readonly byte[] DecodingTable; // Token: 0x04007568 RID: 30056 [Token(Token = "0x4007568")] private static readonly string DefaultVersion; // Token: 0x04007569 RID: 30057 [Token(Token = "0x4007569")] private static readonly ISet AllowedVersions; } }