This site uses cookies own and third. If you continue to browse consider to accept the use of cookies. OK More Info.

[Perl] Ejemplo de Cifrado Vigenere

  • 0 Replies
  • 4120 Views

0 Members and 1 Guest are viewing this topic.

Offline BigBear

  • *
  • Underc0der
  • Posts: 541
  • Actividad:
    0%
  • Reputación 3
    • View Profile

[Perl] Ejemplo de Cifrado Vigenere

  • on: December 13, 2014, 11:23:06 am
Un simple ejemplo del cifrado Vigenere que hice usando un modulo que encontre en cpan.

El codigo :

Code: (perl) You are not allowed to view links. Register or Login
# !usr/bin/perl
# Vigenere Cipher
# Coded By Doddy Hackman in the year 2014

use Crypt::Vigenere;

head();
menu();
copyright();

# Functions

sub head {
    print "\n-- == Vigenere Cipher == --\n";
}

sub copyright {
    print "\n\n-- == (C) Doddy Hackman 2014 == --\n";
}

sub menu {
    print qq(
===============
= Menu        =
===============
1 - Encode    =
2 - Decode    =
3 - Exit      =
===============
);

    print "\n[+] Option : ";
    chomp( my $op = <stdin> );

    if ( $op eq "3" ) {
        copyright();
        <stdin>;
        exit(1);
    }

    print "\n[+] Enter text : ";
    chomp( my $text = <stdin> );

    print "\n[+] Enter Key : ";
    chomp( my $key = <stdin> );

    print "\n[+] Result ...\n\n";

    $tool = Crypt::Vigenere->new($key);

    if ( $op eq "1" ) {
        print $tool->encodeMessage($text);
        <stdin>;
        menu();
    }
    elsif ( $op eq "2" ) {
        print $tool->decodeMessage($text);
        <stdin>;
        menu();
    }
    else {
        menu();
    }

}

# The End ?

Eso es todo.
« Last Edit: December 13, 2014, 11:24:51 am by Doddy »