This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.githubusercontent.com/huoshan12345/799a15cd0fa1e462ee16c68aaf361202/raw/7cadb46f9795d2a8f8bcd8091d0ccfa1fa9267f8/NullableAttributes.cs | |
#pragma warning disable MA0048 // File name must match type name | |
// ReSharper disable once CheckNamespace | |
#define INTERNAL_NULLABLE_ATTRIBUTES | |
#if NETSTANDARD2_0 || NETCOREAPP2_0 || NETCOREAPP2_1 || NETCOREAPP2_2 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472 || NET48 | |
// Licensed to the .NET Foundation under one or more agreements. | |
// The .NET Foundation licenses this file to you under the MIT license. | |
// See the LICENSE file in the project root for more information. | |
namespace System.Diagnostics.CodeAnalysis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class InterfaceBaseInvocationExtension | |
{ | |
private readonly record struct InterfaceMethodInfo(Type InstanceType, Type InterfaceType, MethodInfo Method); | |
private static readonly ConcurrentDictionary<InterfaceMethodInfo, Delegate> _delegates = new(); | |
private readonly struct Unit { } | |
public static void Base<TInterface>(this TInterface instance, Expression<Action<TInterface>> selector) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Packages need to be installed: | |
// Sodium.Core | |
// System.Security.Cryptography.Algorithms | |
// The values of publicKey,keyId,version are from shared_data. | |
// You need to call https://www.instagram.com/data/shared_data/ to get shared_data first | |
public static string GenerateEncPassword(string password, string publicKey, string keyId, string version) | |
{ | |
var time = DateTime.UtcNow.ToTimestamp(); // Unix timestamp | |
var keyBytes = publicKey.HexToBytes(); // Convert a hex string to a byte array |