This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.7 | |
# enable debugging | |
#El programa es producto de varias recopilaciones de rsa y ejemplos de cgi | |
#URLS: http://blog.hackxcrack.es/2011/11/introduccion-la-criptografia-moderna_09.html | |
#http://code.activestate.com/recipes/572196-rsa/ | |
#http://cic.puj.edu.co/wiki/doku.php?id=materias:laboratorio_de_lenguajes_ii:lableng2:ejemplos1 | |
#http://www.tutorialspoint.com/python/python_cgi_programming.htm | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.7 | |
# enable debugging | |
#El programa es producto de varias recopilaciones de rsa y ejemplos de cgi | |
#URLS: http://blog.hackxcrack.es/2011/11/introduccion-la-criptografia-moderna_09.html | |
#http://code.activestate.com/recipes/572196-rsa/ | |
#http://cic.puj.edu.co/wiki/doku.php?id=materias:laboratorio_de_lenguajes_ii:lableng2:ejemplos1 | |
#http://www.tutorialspoint.com/python/python_cgi_programming.htm | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Login</title> | |
</head> | |
<body> | |
<h1>Ingreso al Sistema</h1> | |
<p>Ingrese los siguientes datos: | |
</p> | |
<form name="datos" id="datos"> | |
<table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.7 | |
# enable debugging | |
#El programa es producto de varias recopilaciones de rsa y ejemplos de cgi | |
#URLS: http://blog.hackxcrack.es/2011/11/introduccion-la-criptografia-moderna_09.html | |
#http://code.activestate.com/recipes/572196-rsa/ | |
#http://cic.puj.edu.co/wiki/doku.php?id=materias:laboratorio_de_lenguajes_ii:lableng2:ejemplos1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Algunas funciones fueron obtenidas de la siguiente URL: http://blog.hackxcrack.es/2011/11/introduccion-la-criptografia-moderna_09.html | |
import hashlib | |
import random | |
def hacerentero(s): #Se utiliza una funcion para hacer el mensaje a enteros | |
n = 0 | |
for c in s: | |
n <<= 8 #evaluando los digitos ingresados por el usuario | |
n += ord(c) #se obtiene el orden de c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def AliceDescifrar(Y, x): #Funcion que descifra el mensaje de Bob | |
resultado=Y**x #Se eleva el mensaje de Bob al exponente del x de Alice | |
Bob = Y | |
print "Alice recibe: "+str(Bob) #Se imprime lo que recibe alice | |
print "Bob cifrado= "+str(resultado) #Se imprime el texto cifrado | |
return | |
def BobDescifrar(X, y): #Funcion que desicra el mensaje de Alice | |
resultado=X**y #se eleva el mensaje de Alice al exponente del y de Bob | |
Alice= X |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def repeticiones(todos): #funcion que checa si hay repeticiones | |
for i in range(len(todos)): | |
for j in range(len(todos)): | |
if j!=i: | |
if todos[i]==todos[j]: #conficion que decide cuando hay una repeticion | |
print "repetido encontrado: "+str(todos[i]) #Se agrega el valor del numero repetido | |
return | |
def random(): | |
import random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Generacion | |
attr_accessor :arreglo, :aunico, :arepeticion, :numero, :repeticiones #funcion utilizada para el acceso a objetos | |
arreglo=[] | |
arepeticion=[] | |
repeticiones = 0 | |
aunic=[] #se declaran arreglos y variables a utilizar | |
puts "Ingrese la cantidad de numeros a generar: " #pide el numero de elementos | |
numero = gets | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char* argv[]) | |
{ | |
int n, i, j; | |
srand(time(NULL)); //Se inicializa la semilla con el tiempo del sistema | |
n = atoi(argv[1]); //Se obtiene el valor de n | |
int array[n]; | |
for(i=0;i<n;i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class Generador{ | |
public static void main(String[] args){ | |
int i, j; //declaracion de variables | |
int n = Integer.parseInt(args[0]); //se obtiene valor de n | |
int array[] = new int[n]; //se declara el arreglo contenedor | |
for(i=0;i<n;i++){ | |
array[i]= (int)(Math.random()*99999+10000); //En el ciclo se generan numeros aleatorios de 5 cifras |