Skip to content

LATEX (.latex)

.latex file signature | application/x-latex

Safe

Magic Bytes

Offset 0
25 20 2D 2A 2D 6C 61 74 65 78 2D 2A 2D

Sources: Apache Tika

Extension

.latex

MIME Type

application/x-latex

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .latex files in Python

Python
def is_latex(file_path: str) -> bool:
    """Check if file is a valid LATEX by magic bytes."""
    signature = bytes([0x25, 0x20, 0x2D, 0x2A, 0x2D, 0x6C, 0x61, 0x74, 0x65, 0x78, 0x2D, 0x2A, 0x2D])
    with open(file_path, "rb") as f:
        return f.read(13) == signature

How to validate .latex files in Node.js

Node.js
function isLATEX(buffer: Buffer): boolean {
  const signature = Buffer.from([0x25, 0x20, 0x2D, 0x2A, 0x2D, 0x6C, 0x61, 0x74, 0x65, 0x78, 0x2D, 0x2A, 0x2D]);
  return buffer.subarray(0, 13).equals(signature);
}

How to validate .latex files in Go

Go
func IsLATEX(data []byte) bool {
    signature := []byte{0x25, 0x20, 0x2D, 0x2A, 0x2D, 0x6C, 0x61, 0x74, 0x65, 0x78, 0x2D, 0x2A, 0x2D}
    if len(data) < 13 {
        return false
    }
    return bytes.Equal(data[:13], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .latex file?

A .latex file is a LATEX file.

What are the magic bytes for .latex files?

The magic bytes for LATEX files are 25 20 2D 2A 2D 6C 61 74 65 78 2D 2A 2D at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .latex file?

To validate a .latex file, read the first bytes of the file and compare them against the known magic bytes (25 20 2D 2A 2D 6C 61 74 65 78 2D 2A 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 .latex files?

The primary MIME type for .latex files is application/x-latex.

Is it safe to open .latex files?

LATEX (.latex) 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.