Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • c7b1687
  • /
  • perl
  • /
  • cipher.pl
Raw File
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:efc712fdf58bb3134ee8db89b47a5d51a5da2b99
directory badge Iframe embedding
swh:1:dir:6fe9f7ebaafee609a988be3a56ecc53319a65256
cipher.pl
#!/usr/local/bin/perl

use ExtUtils::testlib;

use SSLeay;

$md=SSLeay::MD::new("md5");

foreach (@SSLeay::Cipher::names)
	{
	($c=SSLeay::Cipher::new($_)) ||
		die "'$_' is an unknown cipher algorithm\n";


	$data="012345678abcdefghijklmnopqrstuvwxyz";
	$c->init("01234567abcdefghABCDEFGH","zyxwvut",1);

	$in =$c->update(substr($data, 0, 5));
	$in.=$c->update(substr($data, 5,10));
	$in.=$c->update(substr($data,15,1));
	$in.=$c->update(substr($data,16));

	$in.=$c->final();

	$c->init("01234567abcdefghABCDEFGH","zyxwvut",0);
	$out=$c->update($in);
	$out.=$c->final();

	($out eq $data) || die "decrypt for $_ failed:$!\n";

	$md->init();
	$md->update($in);
	$digest=$md->final();

	print unpack("H*",$digest);
	printf " %2d %2d %2d %s\n", $c->key_length(), $c->iv_length(),
		$c->block_size(), $c->name();
	}

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top