using System; using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Generators { // Token: 0x02001698 RID: 5784 [Token(Token = "0x2001698")] [StructLayout(3)] public class OpenBsdBCrypt { // Token: 0x06009A99 RID: 39577 RVA: 0x002288A4 File Offset: 0x00226AA4 [Token(Token = "0x6009A99")] [Address(RVA = "0x1F59480", Offset = "0x1F57E80", VA = "0x181F59480")] 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: 0x06009A9A RID: 39578 RVA: 0x0022893C File Offset: 0x00226B3C [Token(Token = "0x6009A9A")] [Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")] public OpenBsdBCrypt() { } // Token: 0x06009A9B RID: 39579 RVA: 0x00228950 File Offset: 0x00226B50 [Token(Token = "0x6009A9B")] [Address(RVA = "0x1F584A0", Offset = "0x1F56EA0", VA = "0x181F584A0")] private static string CreateBcryptString(string version, byte[] password, byte[] salt, int cost) { /* An exception occurred when decompiling this method (06009A9B) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.String BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Generators.OpenBsdBCrypt::CreateBcryptString(System.String,System.Byte[],System.Byte[],System.Int32) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_9C: stloc:ArgumentException(var_20_AB, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("BCrypt cost must be from 4..31"), ldstr:string("cost"))) } 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: 0x06009A9C RID: 39580 RVA: 0x00228A0C File Offset: 0x00226C0C [Token(Token = "0x6009A9C")] [Address(RVA = "0x1F590E0", Offset = "0x1F57AE0", VA = "0x181F590E0")] public static string Generate(char[] password, byte[] salt, int cost) { return OpenBsdBCrypt.Generate(OpenBsdBCrypt.DefaultVersion, password, salt, cost); } // Token: 0x06009A9D RID: 39581 RVA: 0x00228A28 File Offset: 0x00226C28 [Token(Token = "0x6009A9D")] [Address(RVA = "0x1F59170", Offset = "0x1F57B70", VA = "0x181F59170")] 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: 0x06009A9E RID: 39582 RVA: 0x00228ADC File Offset: 0x00226CDC [Token(Token = "0x6009A9E")] [Address(RVA = "0x1F580C0", Offset = "0x1F56AC0", VA = "0x181F580C0")] public static bool CheckPassword(string bcryptString, char[] password) { /* An exception occurred when decompiling this method (06009A9E) 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: 0x06009A9F RID: 39583 RVA: 0x00228BA0 File Offset: 0x00226DA0 [Token(Token = "0x6009A9F")] [Address(RVA = "0x1F58D00", Offset = "0x1F57700", VA = "0x181F58D00")] 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: 0x06009AA0 RID: 39584 RVA: 0x00228C50 File Offset: 0x00226E50 [Token(Token = "0x6009AA0")] [Address(RVA = "0x1F588B0", Offset = "0x1F572B0", VA = "0x181F588B0")] private static byte[] DecodeSaltString(string saltString) { /* An exception occurred when decompiling this method (06009AA0) 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: 0x0400656A RID: 25962 [Token(Token = "0x400656A")] private static readonly byte[] EncodingTable; // Token: 0x0400656B RID: 25963 [Token(Token = "0x400656B")] private static readonly byte[] DecodingTable; // Token: 0x0400656C RID: 25964 [Token(Token = "0x400656C")] private static readonly string DefaultVersion; // Token: 0x0400656D RID: 25965 [Token(Token = "0x400656D")] private static readonly ISet AllowedVersions; } }