Cypher

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit e333c77930cc244bf3a3babffeacbf3dd2263e92
parent 95c089a0a826291f3188b83c4c2f02c6d46d1fc8
Author: Minerva_juppiter <94231606+minerva-jupiter@users.noreply.github.com>
Date:   Mon, 25 Apr 2022 23:25:09 +0900


Diffstat:
MProgram.cs | 23+++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/Program.cs b/Program.cs @@ -39,7 +39,6 @@ static string Control() } } return answer; - answer = null; } @@ -156,6 +155,8 @@ static void encrypt() string[] date = new string[100]; int a = 0; int b = 0; + int c = 0; + int d = 0; //質問 string whereDateFile; @@ -184,19 +185,37 @@ static void encrypt() whereDateFile, System.IO.FileMode.Open, System.IO.FileAccess.Read); + //ファイルを読み込むバイト型配列を作成する byte[] bs = new byte[fileStream.Length]; + //ファイルの内容をすべて読み込む fileStream.Read(bs, 0, bs.Length); + //閉じる fileStream.Close(); + //参照したファイルのビット数が百の倍数か判定する。 + if(bs.Length % 100 == 0) + { + b = bs.Length / 100; + //ファイルを百分割してdata配列に代入 + while (a < 100) + { + date[a] = BitConverter.ToString(BitConverter.GetBytes(bs[a])); + c = c + b; + } + } + else + { + d = bs.Length % 100; + } a = 0; while (a < 100) { //百分割したファイルのそれぞれをdate配列に代入 - date[a] = System.Text.Encoding.ASCII.GetString(bs); + date[a] = BitConverter.ToString(bs); } //配列の順に検索 a = 0;