Reference implementation
{{Short description|Implementation of a specification which serves as an example}}
{{Wiktionary}}
In the software development process, a reference implementation (or, less frequently, sample implementation or model implementation) is a program that implements all requirements from a corresponding specification. The reference implementation often accompanies a technical standard, and demonstrates what should be considered the "correct" behavior of any other implementation of it.
Characteristics and examples
Reference implementations of algorithms, for instance cryptographic algorithms, are often the result or the input of standardization processes. In this function they are often dedicated to the public domain with their source code as public domain software. Examples are the first CERN's httpd,{{Cite web |url=https://home.web.cern.ch/science/computing/birth-web/licensing-web |title=Licensing the Web: For everyone |access-date=2014-08-17 |website=CERN |last=Smith |first=Tim |archive-url=https://web.archive.org/web/20211210174700/https://home.web.cern.ch/science/computing/birth-web/licensing-web |archive-date=2021-12-10 |url-status=live |last2=Flückiger |first2=François}} Serpent cipher, base64 variants,{{Cite web |url=https://libb64.sourceforge.net/ |title=libb64: Base64 Encoding/Decoding Routines |date=2005-11-20 |access-date=2016-02-06 |website=SourceForge |last=Devolve |first=Chris |archive-url=https://web.archive.org/web/20100730214031/http://libb64.sourceforge.net:80/ |archive-date=2010-07-30 |url-status=live}} and SHA-3.{{Cite web |url=http://keccak.noekeon.org/KeccakReferenceAndOptimized-3.2.zip |title=KeccakReferenceAndOptimized-3.2.zip |date=2013-02-27 |access-date=2016-02-06 |website=keccak.noekeon.org |last=Bertoni |first=Guido |archive-url=https://web.archive.org/web/20130930182136id_/http://keccak.noekeon.org/KeccakReferenceAndOptimized-3.2.zip |archive-date=2013-09-30 |url-status=dead |last2=Daemen |first2=Joan |at=/KeccakReferenceAndOptimized/Sources/mainReference.c |format=ZIP |archive-format=ZIP |quote=The Keccak sponge function, designed by: Bertoni, Guido; Daemen, Joan; Peeters, Michaël; Van Assche, Gilles. For more information, feedback or questions, please refer to our website: keccak.noekeon.org/{{cbignore}} / Implementation by the designers, hereby denoted as "the implementer". / To the extent possible under law, the implementer has waived all copyright and related or neighboring rights to the source code in this file. creativecommons.org/publicdomain/zero/1.0/{{cbignore}} |last3=Peeters |first3=Michaël |last4=Van Assche |first4=Gilles}} The Openwall Project maintains a list of several algorithms with their reference source code in the public domain.{{Cite web |url=https://openwall.info/wiki/people/solar/software/public-domain-source-code |title=Source code snippets and frameworks placed in the public domain |date=2009-11-05 |access-date=2017-11-16 |website=Openwall Community Wiki |author1=solar |archive-url=https://web.archive.org/web/20190126164336/https://openwall.info/wiki/people/solar/software/public-domain-source-code |archive-date=2019-01-26 |url-status=live}}
A reference implementation may or may not be production quality. For example, the Fraunhofer reference implementation of the MP3 standard usually does not compare favorably to other common implementations, such as LAME, in listening tests that determine sound quality.{{Cite web |url=https://forum.audacityteam.org/t/media-info-doesnt-match-format-options-selected-for-exported-mp3s/53082 |title=Media Info doesn't match Format Options selected for Exported MP3's - #6 by steve - Windows |date=2019-06-11 |access-date=2024-09-05 |website=Audacity Forum |last=Daulton |first=Steve |archive-url=https://web.archive.org/web/20231202212500/https://forum.audacityteam.org/t/media-info-doesnt-match-format-options-selected-for-exported-mp3s/53082 |archive-date=2023-12-02 |url-status=live}} In contrast, CPython, the reference implementation of the Python programming language,{{Cite web |url=https://peps.python.org/pep-0421/#motivation |title=PEP 421 {{ndash}} Adding sys.implementation |date=2012-04-26 |access-date=2017-01-06 |website=peps.python.org |last=Snow |first=Eric |archive-url=https://web.archive.org/web/20220411231443/https://peps.python.org/pep-0421/#motivation |archive-date=2022-04-11 |url-status=live |publisher=Python Software Foundation (which owns "python.org") |at=Motivation |quote=For a number of years now, the distinction between Python-the-language and CPython (the reference implementation) has been growing. Most of this change is due to the emergence of Jython, IronPython, and PyPy as viable alternate implementations of Python.}} is also the implementation most widely used in production.
Testing
Testing the implementation-vs-specification relationship further enhances the production's inter-process efficiencies:
{{blockquote|A reference implementation is, in general, an implementation of a specification to be used as a definitive interpretation for that specification. During the development of the ... conformance test suite, at least one relatively trusted implementation of each interface is necessary to (1) discover errors or ambiguities in the specification, and (2) validate the correct functioning of the test suite.{{Cite web |url=http://xw2k.sdct.itl.nist.gov/smartcard/document/ref-imp51.pdf |title=Requirements for GSC-IS Reference Implementations |date=2003-03-26 |access-date=2006-07-22 |website=National Institute of Standards and Technology, Information Technology Laboratory |last=Dalci |first=Eric |archive-url=https://web.archive.org/web/20060928231404id_/http://xw2k.sdct.itl.nist.gov/smartcard/document/ref-imp51.pdf |archive-date=2006-09-28 |url-status=dead |last2=Fong |first2=Elizabeth |last3=Goldfine |first3=Alan}}}}
{{blockquote|Characteristics of a Reference Implementation:
- Developed concurrently with the specification and test suite;
- Verifies that specification is implementable;
- Enables the test suite to be tested;
- Serves as a Gold Standard against which other implementations can be measured;
- Helps to clarify the intent of the specification in situations where conformance tests are inadequate{{Cite web |url=http://vote.nist.gov:80/speeches/1%20-%20Specification%20Panel/6%20-%20Curran.pdf |title=Conformance Testing: An Industry Perspective |date=2003-12-10 |access-date=2006-07-22 |website=National Institute of Standards and Technology |last=Curran |first=Patrick |archive-url=https://web.archive.org/web/20031219120934id_/http://vote.nist.gov:80/speeches/1%20-%20Specification%20Panel/6%20-%20Curran.pdf |archive-date=2003-12-19 |url-status=dead |publisher=Sun Microsystems}}}}