Posted By

eiger824 on 02/21/13


Tagged

algorithm Encryption c++ mutant


Versions (?)

Mutant Encryption Algorithm


 / Published in: C++
 

URL: http://programmingeiger824.blogspot.com

This piece of code is aimed to encrypt passwords, but this time it won't return a single character array, but a constantly-changing matrix which contains the password.

  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. using namespace std;
  5.  
  6. void main(){
  7. char matrix[50][50]={0};
  8. char password[30]={0};
  9.  
  10. for(int i=0;i<50;i++){//defining matrix
  11. for(int j=0;j<50;j++){
  12. matrix[i][j]=rand()&(90)+33;
  13. }
  14. }
  15.  
  16. cout<<"Type password: ";
  17. cin>>password;
  18. system("cls");
  19.  
  20. cout<<"Type password: ";
  21. for(int i=0;i<strlen(password);i++){
  22. cout<<"*";
  23. }cout<<endl;
  24. cout<<"Length of typed password: "<<strlen(password)<<endl;
  25. while(1){
  26. cout<<"Type password: ";
  27. for(int i=0;i<strlen(password);i++){
  28. cout<<"*";
  29. }cout<<endl;
  30. for(int i=0;i<50;i++){//defining matrix
  31. for(int j=0;j<50;j++){
  32. matrix[i][j]=rand()%(90)+33;
  33. }
  34. }
  35.  
  36. for(int l=0;l<strlen(password);l++){
  37. matrix[l][rand()%(21)+13]=password[l];//between columns 13 and 36
  38.  
  39. }
  40. for(int k=0;k<50;k++){
  41. for(int l=0;l<50;l++){
  42. cout<<matrix[k][l];
  43.  
  44. }cout<<endl;
  45. }
  46. system("cls");
  47. }
  48. system("pause");
  49. }

Report this snippet  

You need to login to post a comment.