Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

HASH구하기/류주영,황재선: Difference between revisions

From ZeroWiki
imported>Unknown
No edit summary
 
(Repair batch-0002 pages from live compare)
 
Line 7: Line 7:
  ifstream fin("input"); // fin과 input.txt를 연결   
  ifstream fin("input"); // fin과 input.txt를 연결   
  ofstream fout("output.txt"); // fout과 output.txt를 연결
  ofstream fout("output.txt"); // fout과 output.txt를 연결
  char pass[100];
  char pass[100];
  fin >> pass;
  fin >> pass;
 
 
Line 13: Line 13:
 
 
 
 
  int hash[5] = {0};
  int hash[5] = {0};
 
 
  for(int i=0;i<5;i++)
  for(int i=0;i<5;i++)
Line 20: Line 20:
  for(int j=i;j<strlen(pass);j+=5)
  for(int j=i;j<strlen(pass);j+=5)
  {
  {
  hash[i] += (int)(pass[j]);
  hash[i] += (int)(pass[j]);
  }
  }
 
 
Line 27: Line 27:
  for(int k=0;k<5;k++)
  for(int k=0;k<5;k++)
  {
  {
  cout << hash[k] << " ";
  cout << hash[k] << " ";
  fout << hash[k] << " ";
  fout << hash[k] << " ";
  }
  }
  return 0;
  return 0;
  }
  }
----
----
[[암호화실습]], [[데블스캠프2004/목요일]]
[[암호화실습]], 데블스캠프2004/목요일
 

Latest revision as of 00:16, 27 March 2026

#include <iostream>
#include <fstream>
#include<string>
using namespace std; 
int main() 
{
	ifstream fin("input"); // fin과 input.txt를 연결  
	ofstream fout("output.txt"); // fout과 output.txt를 연결
	char pass[100];
	fin >> pass;
	
	
	
	
	int hash[5] = {0};
	
	for(int i=0;i<5;i++)
	{
		
		for(int j=i;j<strlen(pass);j+=5)
		{
			hash[i] += (int)(pass[j]);
		}
		
		
	}
	for(int k=0;k<5;k++)
	{
		cout << hash[k] << " ";
		fout << hash[k] << " ";
	}
	return 0;
}

암호화실습, 데블스캠프2004/목요일