Hawkynt

Morse Code (International)

Method of transmitting text information as a series of on-off tones, lights, or clicks using standardized sequences of short and long signals called dots and dashes. Educational implementation following ITU-R M.1677-1 standard. ITU-R M.1677-1 only defines patterns for uppercase letters, digits, a fixed set of punctuation, and space; it has no case distinction and no representation for control characters or arbitrary binary data, so any other byte is rejected rather than silently mapped to β€˜?’ or case-folded.

Properties

Property Value
Category Encoding Schemes
Sub-category Telegraph Encoding
Security status πŸŽ“ Educational Only
Complexity Beginner
Inventor Samuel Morse
Year 1836
Origin πŸ‡ΊπŸ‡Έ United States
Restricted input domain Yes
Source algorithms/encoding/morse.js

Security

Status: πŸŽ“ Educational Only

No vulnerabilities are recorded for this implementation.

Documentation

References

Test vectors

5 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.

Vector 1 β€” Morse empty string test

Field Value
input (empty)
expected (empty)

Vector 2 β€” Single letter E test - ITU-R M.1677-1

Field Value
input 45
expected 2e

Vector 3 β€” SOS distress signal test - Morse

Source: ITU-R M.1677-1 standard

Field Value
input 534f53
expected 2e2e2e202d2d2d202e2e2e

Vector 4 β€” Basic word encoding test - Morse

Source: Educational standard

Field Value
input 48454c4c4f
expected 2e2e2e2e202e202e2d2e2e202e2d2e2e202d2d2d

Vector 5 β€” Exact-spacing and prosign-collision regression test - a doubled space must round-trip exactly (previous word-splitting collapsed runs of whitespace), and β€˜&’/’=’/’(β€˜ must decode back to themselves rather than to a same-pattern prosign

Field Value
input 534f532020263d28
expected 2e2e2e202d2d2d202e2e2e202f202f20 2e2d2e2e2e202d2e2e2e2d202d2e2d2d 2e

← All algorithms