Files
Cody Boone Ferguson 0d65af1b2b Add unobfuscated code from @SirWumpus
The entries 2004/hibachi and 2005/mynx have unobfuscated code now.

2004/hibachi has a configure script that is used along the lines of the
original entry (with some adjustments and fixes) and the hibachi.alt.c
had to have ctype.h included too. The directory src/localhost was copied
to src-alt/localhost but the rest of src/ was from Anthony. The Makefile
had to be updated to build this version.

2005/mynx does have a configure script but it is, just like the original
entry, unused and so the unobfuscated (in source-alt/) is also unused.
The mynx.alt.c was changed to mynx.alt2.c and the unobfuscated code was
made mynx.alt.c.

Updated manifest, rebuilt .entry.json and index.html files.

After a question is answered and taken care of (in one of 199[1-3]/ant -
not sure which one) issue #2513 can possibly be closed as complete
(though the manifest updates will have to be looked at more when 2004
and 2005 are reviewed).
2024-07-08 13:11:00 -07:00

81 lines
1.9 KiB
Ruby
Executable File

#!/usr/bin/ruby
require 'cgi'
require ENV['DOCUMENT_ROOT'] + '/test/ruby/LUHN'
if ENV['QUERY_STRING'].nil? then
answer = ''
numebr = ''
else
query = CGI.parse(ENV['QUERY_STRING'])
number = query['number'].to_s
case query['action'].to_s
when 'Validate'
is_valid = LUHN.valid?(number)
answer = number
when 'Generate'
digit = LUHN.generate(number)
answer = "#{number}" + digit.to_s
is_valid = ! digit.nil?
end
end
puts <<"EOT"
HTTP/1.0 200 OK
Content-Type: text/html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>
Hibachi - Playing with LUHN checksums in Ruby
</title>
</head>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>
<body background="../../Img/hot-coal-edge-110-indent.png" style="margins: 0 0 0 0; padding: 0 0 0 0;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="130">
<img alt="" src="../../Img/mrpixel.gif" width="130" height="1">
</td>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="500">
<tr>
<td>
<h2>Playing with LUHN checksums in Ruby<br/>"mod 10 Double-Add-Double"</h2>
<p>Enter an alpha-numeric string like a credit card number or International Securities Identification Number (ISO 6166).
Click validate to test if the entered string is correct. Click generate to append the check digit to the string.
</p>
<form name="luhn" method="GET" action="index.rb">
<textarea name="number" wrap="virtual" rows="2" cols="30">#{answer}</textarea>
<br/><b>#{ is_valid ? "Is valid." : "Is NOT valid." }</b>
<br/>
<br/>
<input type="submit" name="action" value="Validate">
&nbsp;&nbsp;
<input type="submit" name="action" value="Generate">
&nbsp;&nbsp;
<input type="button" value="Clear" onclick="this.form.number.value = ''">
</form>
<hr>
<a href="../../#Test">Return to HIBACHI</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
EOT
exit(0)