Skip to content

Instantly share code, notes, and snippets.

@OpBug
OpBug / HashPuzzle.cs
Last active August 28, 2020 05:01
C# proof-of-work implementation inspired by Hashcash to deter denial of service attacks and other service abuses such as spam.
using System;
using System.Security.Cryptography;
/// <summary>
/// Computes and verifies proof-of-work challenges inspired by Hashcash to deter denial of service attacks and other service abuses such as spam.
/// </summary>
public sealed class HashPuzzle
{
#region " Properties "
@OpBug
OpBug / HMACAlgorithmName.cs
Last active October 29, 2017 20:17
C# implementation of HMAC-based key derivation functionality, HKDF.
using System;
/// <summary>
/// Specifies the name of a cryptographic HMAC algorithm.
/// </summary>
public struct HMACAlgorithmName : IEquatable<HMACAlgorithmName>
{
#region " Members "
private readonly string _name;