[Csharp-classlib-cvs] demos/XOR/XOR AssemblyInfo.cs,NONE,1.1 Main.cs,NONE,1.1 XOR.prjx,NONE,1.1
Status: Inactive
Brought to you by:
generalpd
From: Marcel K. <gen...@us...> - 2005-05-05 01:21:55
|
Update of /cvsroot/csharp-classlib/demos/XOR/XOR In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21020/XOR/XOR Added Files: AssemblyInfo.cs Main.cs XOR.prjx Log Message: - added demo for XOR encryption class --- NEW FILE: Main.cs --- // C# ClassLib (Demos) // http://csharp-classlib.sourceforge.net // // // Copyright (C) 2005 Marcel Joachim Kloubert // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // using System; namespace CSharp_ClassLib.Demos.XOR { /*! \brief Main class * * Main class * * \author generalpd * * \version $Revision: 1.1 $ * * \date 2005-05-05 * * \bug none * * \todo none * * \remarks Last changed by: $Author: generalpd $ in revision $Revision: 1.1 $ on $Date: 2005/05/05 01:21:46 $ * * \note * $Log: Main.cs,v $ * Revision 1.1 2005/05/05 01:21:46 generalpd * - added demo for XOR encryption class * * */ public class MainClass { private CSharp_ClassLib.Cryptography.XOR m_oXOR; public MainClass() { return; } /*! \fn static int Main(string[] args) * \brief Entry point * * \param args Array of command line arguments * * \return Error code (0 => no error; 1 => Exception) * */ public static int Main(string[] args) { // run the demo return ( new CSharp_ClassLib.Demos.XOR.MainClass() ).Run(args); } /*! \fn int Run (string[] args) * \brief Non-Static version of Main() * * \param args Array of command line arguments * * \return Error code (0 => no error; 1 => Exception) * */ private int Run (string[] args) { try { // create new instance this.m_oXOR = new CSharp_ClassLib.Cryptography.XOR(); // set key and expression this.m_oXOR.ExpressionString = "http://csharp-classlib.sf.net"; this.m_oXOR.KeyString = "generalpdWearsFemaleUnderwear"; Console.WriteLine("Key (hex): " +this. m_oXOR.KeyHex); Console.WriteLine("\n"); // output encrypted string as hex Console.WriteLine("Step 1 (encrypt):"); Console.WriteLine("------------"); Console.WriteLine("Old (hex): " + this.m_oXOR.ExpressionHex); Console.WriteLine("New (hex): " + this.m_oXOR.ExpressionEncryptedHex); Console.WriteLine("\n"); // decrypt and output this.m_oXOR.ExpressionHex = this.m_oXOR.ExpressionEncryptedHex; Console.WriteLine("Step 2 (decrypt):"); Console.WriteLine("------------"); Console.WriteLine("Old (hex): " + this.m_oXOR.ExpressionHex); Console.WriteLine("New (hex): " + this.m_oXOR.ExpressionEncryptedHex); // start cleaning System.GC.Collect(); System.GC.WaitForPendingFinalizers(); return 0; } catch (System.Exception e) { // exception Console.WriteLine("EXCEPTION: " + e.Message); return 1; } } } } --- NEW FILE: XOR.prjx --- <Project name="XOR" standardNamespace="XOR" description="" newfilesearch="None" enableviewstate="True" version="1.1" projecttype="C#"> <Contents> <File name=".\Main.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\AssemblyInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\Classes" subtype="Directory" buildaction="Compile" dependson="" data="" /> <File name="..\Classes\clsXOREncryption.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References /> <DeploymentInformation target="" script="" strategy="File" /> <Configuration runwithwarnings="True" name="Debug"> <CodeGeneration runtime="Mono" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Debug" assembly="XOR" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configurations active="Debug"> <Configuration runwithwarnings="True" name="Debug"> <CodeGeneration runtime="Mono" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Debug" assembly="XOR" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> <CodeGeneration runtime="Mono" compiler="Mcs" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\..\bin\Release" assembly="XOR" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> </Configurations> </Project> --- NEW FILE: AssemblyInfo.cs --- using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following // attributes. // // change them to the information which is associated with the assembly // you compile. [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has following format : // // Major.Minor.Build.Revision // // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): [assembly: AssemblyVersion("1.0.*")] // The following attributes specify the key for the sign of your assembly. See the // .NET Framework documentation for more information about signing. // This is not required, if you don't want signing let these attributes like they're. [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] |