Table of Contents

Sedol Class

Definition

Namespace
Bodu.IO.Hashing.CheckDigits
Assembly
Bodu.IO.Hashing.dll
Package
Bodu.IO.Hashing 1.0.0
Source
Sedol.cs

Computes the check digit of a 7-character Stock Exchange Daily Official List (SEDOL) identifier using the weighted modulus-10 scheme defined by the London Stock Exchange. This class cannot be inherited.

public sealed class Sedol : AlphanumericCheckDigitAlgorithm
Inheritance
Sedol
Inherited Members
Extension Methods

Examples

// Single-call computation against the 6-character body (consonants and digits only).
char check = Sedol.Compute("B0WNLY");   // '7'

// Full-sequence validation.
bool ok = Sedol.IsValid("B0WNLY7");     // true

// Streaming use when the body is built up incrementally.
var algo = new Sedol();
algo.Append("B0WNLY");
char d = algo.GetCurrentCheckDigit();   // '7'

Remarks

SEDOL identifiers comprise six body characters followed by a single numeric check digit. Body characters are drawn from the decimal digits and the uppercase Latin consonants - vowels (A, E, I, O, U) are not permitted in any body position and will cause input-validation exceptions.

The weight pattern {1, 3, 1, 7, 3, 9} is applied from left to right across the six body characters; each character's numeric value (digits: 0-9; letters: A=10 … Z=35) is multiplied by its position weight. The check digit is chosen so the weighted sum is a multiple of ten.

Worked example. For the body "B0WNLY", the computed check digit is '7', and the resulting SEDOL "B0WNLY7" is therefore valid.

important

This algorithm is not cryptographically secure and should not be used for password hashing, digital signatures, or integrity validation in security-sensitive applications.

Constructors

Sedol()

Initializes a new instance of the Sedol class.

public Sedol()

Fields

BodyLength

The required body length of 6 characters.

public const int BodyLength = 6

Field Value

int

SequenceLength

The required full-sequence length of 7 characters.

public const int SequenceLength = 7

Field Value

int

Properties

AlgorithmName

Gets the canonical name of the algorithm, suitable for diagnostic output and logging.

public override string AlgorithmName { get; }

Property Value

string

A short, stable identifier such as "Luhn", "IBAN", or "ISO 7064 MOD 97-10".

InputAlphabet

Gets the subset of ASCII from which this algorithm accepts body characters.

public override CheckDigitInputAlphabet InputAlphabet { get; }

Property Value

CheckDigitInputAlphabet

The declared input alphabet.

OutputAlphabet

Gets the subset of ASCII from which this algorithm may emit its check character.

public override CheckDigitOutputAlphabet OutputAlphabet { get; }

Property Value

CheckDigitOutputAlphabet

The declared output alphabet.

Methods

Append(ReadOnlySpan<char>)

Absorbs the supplied characters into the running check-value state.

public override void Append(ReadOnlySpan<char> body)

Parameters

body ReadOnlySpan<char>

The characters to append. Each element must belong to the algorithm's accepted input alphabet. An empty span is a permitted no-op.

Exceptions

ArgumentOutOfRangeException

Thrown when body contains any character outside the algorithm's accepted input alphabet.

Compute(ReadOnlySpan<char>)

Computes the SEDOL check digit for the supplied body without allocating a streaming instance.

public static char Compute(ReadOnlySpan<char> body)

Parameters

body ReadOnlySpan<char>

The body characters. Each must be an ASCII decimal digit or uppercase consonant.

Returns

char

The check digit as an ASCII character in the range '0' to '9'.

Exceptions

ArgumentOutOfRangeException

Thrown when body contains a vowel or a character outside the SEDOL alphabet.

GetCurrentCheckDigit()

Returns the check character computed for the body absorbed since the last Reset() (or since construction).

public override char GetCurrentCheckDigit()

Returns

char

The check character as an ASCII character drawn from OutputAlphabet.

Remarks

This call is non-destructive; the running state is unaffected and the method may be invoked any number of times with identical results between appends.

IsValid(ReadOnlySpan<char>)

Determines whether the supplied sequence, comprising a six-character body followed by a single-digit SEDOL check, is consistent.

public static bool IsValid(ReadOnlySpan<char> valueIncludingCheck)

Parameters

valueIncludingCheck ReadOnlySpan<char>

The complete seven-character SEDOL.

Returns

bool

true if the sequence evaluates as valid under SEDOL; otherwise, false - including the case where valueIncludingCheck is empty, the length is wrong, any body character is a vowel or non-alphanumeric, or the check character is not a decimal digit.

Reset()

Resets the algorithm to its initial state, discarding any characters previously absorbed.

public override void Reset()

Remarks

Equivalent in behavior to constructing a fresh instance of the same concrete type.

Applies to

ProductVersions
.NET8, 10