How to resolve the algorithm SHA-1 step by step in the Oberon-2 programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm SHA-1 step by step in the Oberon-2 programming language

Table of Contents

Problem Statement

SHA-1 or SHA1 is a one-way hash function; it computes a 160-bit message digest. SHA-1 often appears in security protocols; for example, many HTTPS websites use RSA with SHA-1 to secure their connections. BitTorrent uses SHA-1 to verify downloads. Git and Mercurial use SHA-1 digests to identify commits. A US government standard, FIPS 180-1, defines SHA-1. Find the SHA-1 message digest for a string of octets. You may either call a SHA-1 library, or implement SHA-1 in your language. Both approaches interest Rosetta Code.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm SHA-1 step by step in the Oberon-2 programming language

Source code in the oberon-2 programming language

MODULE SHA1;
IMPORT 
  Crypto:SHA1,
  Crypto:Utils,
  Strings,
  Out;
VAR
  h: SHA1.Hash;
  str: ARRAY 128 OF CHAR;
BEGIN
  h := SHA1.NewHash();
  h.Initialize;
  str := "Rosetta Code";
  h.Update(str,0,Strings.Length(str));
  h.GetHash(str,0);
  Out.String("SHA1: ");Utils.PrintHex(str,0,h.size);Out.Ln
END SHA1.

  

You may also check:How to resolve the algorithm Cholesky decomposition step by step in the Wren programming language
You may also check:How to resolve the algorithm K-means++ clustering step by step in the Julia programming language
You may also check:How to resolve the algorithm Sorting algorithms/Insertion sort step by step in the Quackery programming language
You may also check:How to resolve the algorithm Multiple distinct objects step by step in the Java programming language
You may also check:How to resolve the algorithm Polyspiral step by step in the AutoHotkey programming language