close

Trust Me!! Trust You!!


  • Blog
  • Local Log
  • Tag Cloud
  • Key Log
  • Guestbook
  • RSS Feed
  • Write a Post
  • Admin

혹시 블로그 스킨이 깨져 보이시나요? 최신버전의 Internet Explorer(Windows용), Opera, Firefox를 사용해보세요.

sha256 checksum

App 프로그래밍
2016/06/29 16:34
 


c# ------------------------------------------------------------------------------------

        private void button6_Click(object sender, EventArgs e)
        {

            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "Checksum Files|*.*";
            openFileDialog1.Title = "SHA256 체크를 하실 파일을 선택하세요";

            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string checksum = "";
                string path = openFileDialog1.FileName;

                using (System.IO.FileStream stream = System.IO.File.OpenRead(path))
                {
                    System.Security.Cryptography.SHA256Managed sha = new System.Security.Cryptography.SHA256Managed();
                    byte[] bytes = sha.ComputeHash(stream);
                    checksum = BitConverter.ToString(bytes).Replace("-", String.Empty);
                }

                MessageBox.Show(checksum.ToUpper());
            }


        }

java---------------------------------------------------------------------------------
import java.io.FileInputStream;
import java.security.MessageDigest;

public class SHACheckSumExample
{
    public static void main(String[] args)throws Exception
    {
        MessageDigest md = MessageDigest.getInstance("SHA-256");
        FileInputStream fis = new FileInputStream("c:\\J2060408462350.png");
       
        byte[] dataBytes = new byte[1024];
    
        int nread = 0;
        while ((nread = fis.read(dataBytes)) != -1) {
          md.update(dataBytes, 0, nread);
        };
        byte[] mdbytes = md.digest();
    
        //convert the byte to hex format method 1
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < mdbytes.length; i++) {
          sb.append(Integer.toString((mdbytes[i] & 0xff) + 0x100, 16).substring(1));
        }

        System.out.println("Hex format : " + sb.toString());
       
    }
}

javac SHACheckSumExample.java
java SHACheckSumExample

이올린에 북마크하기
No received trackback. / No comment.

Trackback Address :: http://viper150.cafe24.com/trackback/283

You can also say.

Prev 1 ... 17 18 19 20 21 22 23 24 25 ... 298 Next
블로그 이미지
이것저것 불펌금지도 퍼다가 담습니다. 외부에 비공개된 페이지 입니다. By. 어른왕자

카테고리

  • 전체 (298)
    • 사는 이야기 (115)
    • 웹 프로그래밍 (102)
    • App 프로그래밍 (22)
    • IT 뉴스&기타 (22)
    • 박한별 (4)
    • 역사&기타지식 (9)

태그목록

  • 착각
  • kbs
  • 비사
  • 운동
  • 만들기
  • PC일체형의자
  • 명품지갑
  • 몰래카메라
  • 달걀찜
  • java
  • 살수대첩
  • 삼성
  • 박근혜
  • 톰켓
  • 탕평책
  • Pop
  • 갤럽
  • 락산
  • Servlet
  • 윈도우
  • 6.25
  • 기린
  • 팝
  • 정부
  • Billy Joel
  • Logparser
  • html5
  • 고구려
  • vga성능
  • 탬버린

최근에 올라온 글

  • 보험사의 조정신청 대응방법.
  • 어느 천재의 앞선 시선.
  • [병맛더빙] 누구게..... (1)
  • 韓경제 `회색 코뿔소` 상황...
  • SVN Connector 설치 URL.
  • 군대를 가지 않는 서울대생.
  • “운은 하늘의 귀여움 받는...
  • 목장에서 알바하다가 캐스...
  • [펌]믿고 거르는 관상.
  • 하루에 1세트씩 하면 좋다...

최근에 달린 댓글

  • 저도 칭구덕에 이젠 큰 부자가... 가현 01:41
  • 저도 칭구덕에 이젠 큰 부자가... 가현 04/12
  • 배우 김정현은 길지 않은 연기... 김정현 04/10
  • 정세균 국무총리는 4일 신종... 정세영 04/07
  • <p> '학폭을 인정한 적 없는'... 이가흔 04/05

최근에 받은 트랙백

  • Solace Salts Bold Tobacco. Solace Salts Bold Tobacco 03/29
  • read this post from Bookie 7. read this post from Bookie 7 02/28
  • công ty may đồng phục. công ty may đồng phục 01/08
  • Israelnightclub`s recent blo... Israelnightclub`s recent blo.. 01/06
  • Suggested Browsing. Suggested Browsing 01/06

글 보관함

  • 2019/03 (1)
  • 2018/12 (1)
  • 2018/09 (1)
  • 2018/08 (1)
  • 2018/02 (1)

달력

«   2021/04   »
일 월 화 수 목 금 토
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  

링크

  • Total : 265566
  • Today : 36
  • Yesterday : 74
Tattertools
Eolin
rss

어른왕자's blog is powered byTattertools1.1.2.2 : Animato