This file contains hidden or 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
using System.Security.Cryptography; | |
public static class Aes | |
{ | |
public static byte[] Encrypt(byte[] data, byte[] key) | |
{ | |
if (data == null) | |
throw new ArgumentNullException("data"); | |
if (key == null) | |
throw new ArgumentNullException("key"); |
This file contains hidden or 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
using System; | |
using System.Collections.Specialized; | |
using System.IO; | |
using System.Net; | |
using System.Runtime.Serialization; | |
using System.Runtime.Serialization.Json; | |
using System.Text; | |
namespace PasteSx | |
{ |
This file contains hidden or 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
using System; | |
using System.Reflection; | |
using Microsoft.Win32; | |
/// <summary> | |
/// Stores and accesses user preferences between sessions. | |
/// </summary> | |
public static class UserPrefs | |
{ | |
private static readonly RegistryKey MainKey; |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Numerics; | |
using System.Runtime.Serialization; | |
using System.Security.Cryptography; | |
using System.Xml.Serialization; | |
using Org.BouncyCastle.Asn1.Sec; | |
namespace BitcoinTools |
This file contains hidden or 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
using System; | |
using System.Linq; | |
using System.Security.Cryptography; | |
using System.Web; | |
namespace GAuthWrapper | |
{ | |
public static class GAuthProvider | |
{ | |
public static int CodeLength { get; set; } |
This file contains hidden or 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
<?php | |
class MbamGen { | |
public function get_key() { | |
$data = [ | |
'id' => $this->random_char() . $this->random_char() . $this->random_char() . $this->random_char() . $this->random_char(), | |
'key' => '' | |
]; | |
$hash = strtoupper(md5($data['id'])); |
This file contains hidden or 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
function getKey(identifier) { | |
var chars = '0123456789ABCDEFGHJKLMNPQRTUVWXY', | |
hash = CryptoJS.MD5(identifier).toString().toUpperCase(), | |
parts = []; | |
for (var i = 0; i < 32; i += 2) { | |
var nextDigit = parseInt(hash.substr(i, 2), 16) & 31, | |
withDash = (((i % 8) == 0) && (i > 0)); | |
parts.push(withDash ? '-' : ''); |
This file contains hidden or 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 string GetOpticCdnCookie(string source) | |
{ | |
var matches = Regex.Matches(source, "var .* = \"(.*)\""); | |
if (matches.Count != 10) return null; | |
var combined = string.Concat(matches[0].Groups[1].Value, matches[1].Groups[1].Value, | |
matches[2].Groups[1].Value, matches[3].Groups[1].Value, matches[8].Groups[1].Value, | |
matches[9].Groups[1].Value, matches[4].Groups[1].Value, matches[5].Groups[1].Value, | |
matches[6].Groups[1].Value, matches[7].Groups[1].Value); | |
using (var sha = new SHA1Managed()) | |
{ |
This file contains hidden or 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 class ChangeCalculator | |
{ | |
public static Dictionary<decimal, decimal> GetUsdChange(decimal dollars) | |
{ | |
return GetChange(dollars, new[] {100, 50, 20, 10, 5, 1, .25M, .10M, .05M, .01M}); | |
} | |
public static Dictionary<decimal, decimal> GetChange(decimal amount, IEnumerable<decimal> denominations) | |
{ | |
denominations = denominations.OrderByDescending(i => i); |