Skip to content

KGB archive (.kgb)

.kgb file signature | application/octet-stream

KGB archive

Safe

Magic Bytes

Offset 0
4B 47 42 5F 61 72 63 68 20 2D

Sources: Gary Kessler

Extension

.kgb

MIME Type

application/octet-stream

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .kgb files in Python

Python
def is_kgb(file_path: str) -> bool:
    """Check if file is a valid KGB by magic bytes."""
    signature = bytes([0x4B, 0x47, 0x42, 0x5F, 0x61, 0x72, 0x63, 0x68, 0x20, 0x2D])
    with open(file_path, "rb") as f:
        return f.read(10) == signature

How to validate .kgb files in Node.js

Node.js
function isKGB(buffer: Buffer): boolean {
  const signature = Buffer.from([0x4B, 0x47, 0x42, 0x5F, 0x61, 0x72, 0x63, 0x68, 0x20, 0x2D]);
  return buffer.subarray(0, 10).equals(signature);
}

How to validate .kgb files in Go

Go
func IsKGB(data []byte) bool {
    signature := []byte{0x4B, 0x47, 0x42, 0x5F, 0x61, 0x72, 0x63, 0x68, 0x20, 0x2D}
    if len(data) < 10 {
        return false
    }
    return bytes.Equal(data[:10], signature)
}

API Endpoint

GET /api/v1/kgb
curl https://filesignature.org/api/v1/kgb

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .kgb file?

A .kgb file is a KGB archive file. KGB archive

What are the magic bytes for .kgb files?

The magic bytes for KGB archive files are 4B 47 42 5F 61 72 63 68 20 2D at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .kgb file?

To validate a .kgb file, read the first bytes of the file and compare them against the known magic bytes (4B 47 42 5F 61 72 63 68 20 2D) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .kgb files?

There is no officially registered MIME type for .kgb files. Systems typically use application/octet-stream as a generic fallback when handling this format.

Is it safe to open .kgb files?

KGB archive (.kgb) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.