# check file HASH with SHA256

การทำ HASH ด้วย วิธีการ [SHA256](https://en.wikipedia.org/wiki/SHA-2) (Secure hash algolithm) เป็นวิธีการเปลี่ยน Input ที่มีขนาดใดๆให้เป็น Output ขนาด 256 Bit ด้วยอัลกอริทึม [SHA256](https://en.wikipedia.org/wiki/SHA-2) ซึ่งไว้ตรวจสอบว่าข้อมูล Input ดังกล่าวไม่มีการถูกแก้ไขเปลี่ยนแปลงใดๆ การทำ HASH ดังกล่าวเพื่อแสดงความคงสถาพของข้อมูลนั้นๆ ซึ่งการแก้ไข Input แค่เพียง 1 ตัวอักษรจะทำให้ค่า HASH ที่ได้รับเปลี่ยนแปลงไปทันทีโดยสิ้นเชิง ผู้ดูแลระบบสามารถตรวจสอบคงสภาพของข้อมูลได้โดยง่าย จากการเรียกใช้ อัลกอริทึม [SHA256 ](https://en.wikipedia.org/wiki/SHA-2)จาก Website ต่างๆหรือ Load โปรแกรมที่ทำหน้าที่ดังกล่าวมาติดตั้งไว้ในเครื่องคอมพิวเตอร์ ในที่นี้จะขอยกตัวอย่าง website ที่ให้บริการทำ HASH ด้วยวิธีการ [SHA256](https://en.wikipedia.org/wiki/SHA-2) เช่น

{% embed url="<https://emn178.github.io/online-tools/sha256.html>" %}
<https://emn178.github.io/online-tools/sha256.html>
{% endembed %}

<figure><img src="/files/3oJTMIdGdHKaRlzYB5SJ" alt=""><figcaption><p>ตัวอย่างการสร้าง SHA256</p></figcaption></figure>

ยกตัวอย่างเช่น เมื่อใช้ค่า Input เป็น Hello World จะได้ค่า output ที่ผ่านการทำ SHA256 เป็น 64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c

<figure><img src="/files/F3ReivBitm44uiM1jXIt" alt=""><figcaption></figcaption></figure>

เมื่อทดสอบเปลี่ยนค่า Input เป็น Hello Warld  (เปลี่ยนจาก World เป็น Warld) จะได้ค่า output เป็น afab019330eb8ab403ba8400e52eb9008fdf7652ce9397ddc4839b4d5be4c1ac ซึ่งจะต่างกันโดยสิ้นเชิงทั้งๆที่ข้อความ Input เปลี่ยนแปลงเพียงตัวอักษรเดียวเท่านั้น&#x20;

ในการตรวจสอบความคงสภาพของข้อมูลใน Seara สามารถทดสอบได้ด้วยวิธีการเดียวกันโดยใช้ Input เป็น Logfile ที่ตอบการทดสอบ <mark style="color:red;">(ใช้นามสกุล.gz ได้เลยโดยไม่ต้องแตก File)</mark> โดย Upload เข้าไปยัง Website ระบบจะดำเนินการคำนวณค่า HASH ด้วยวิธีการ SHA256 ของ file ดังกล่าว และเราสามารถนำ output ที่ได้มาเทียบกับค่าที่ถูกเก็บไว้ในฐานข้อมูลของระบบเพื่อตรวจสอบว่าตรงกันหรือไม่ ยกตัวอย่างเช่น&#x20;

<figure><img src="/files/xuV17WI3uYQs5jsbLGsN" alt=""><figcaption><p>ตัวอย่างการ ตรวจสอบ Logfile</p></figcaption></figure>

firewall.log-2023-02-26H23.gz เป็นไฟล์ Internet Traffic Log เมื่อวันที่ 26 เดือนกุมภาพันธ์ 2023 เวลา 22.00-23:00 เมื่อตรวจสอบ ![](/files/48XSUrp3uOBolTuw98sN) ในระบบจะได้ค่าดังนี้ 4d042baa1ad70c656546ef25ccd9827721cbfdbfa0e221e3e583af621219fea1

ตรวจสอบค่าโดย Download file ดังกล่าวไปตรวจสอบที่ Website

{% embed url="<https://www.strerr.com/en/sha256_file.html>" %}

จะได้ค่า 4d042baa1ad70c656546ef25ccd9827721cbfdbfa0e221e3e583af621219fea1 ตามรูป

<figure><img src="/files/AFa197myn30kVFDtlhWy" alt=""><figcaption></figcaption></figure>

ซึ่งจะพบว่าตรงกันกับค่า ![](/files/48XSUrp3uOBolTuw98sN) ที่ถูกเก็บไว้ในฐานข้อมูลดังนั้นจึงสามารถพิสูจน์ได้ว่า file ดังกล่าวมีข้อมูลที่ถูกต้องและไม่มีการแก้ไขเปลี่ยนแปลงข้อมูลใดๆ


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.seara.biz/appendix/check-file-hash-with-sha256.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
