Example Usage

  Blog    |     January 30, 2026

To determine if a product is fake, we need to verify its authenticity by comparing it against known genuine products. Here's a step-by-step approach to create a "Fake Product Test":

Key Checks for Authenticity:

  1. Model Number:

    • Genuine products have specific model numbers (e.g., Genuine-X1).
    • Fake Indicator: Model numbers deviate from the genuine pattern (e.g., Fake-X1).
  2. Serial Number Format:

    • Genuine serial numbers follow a strict pattern (e.g., start with S followed by 9 digits: S123456789).
    • Fake Indicator: Incorrect length, missing prefix, or non-digit characters (e.g., S12345678 or A123456789).
  3. Manufacturing Date:

    • Genuine products are manufactured within a valid date range (e.g., 2020-01-01 to 2023-12-31).
    • Fake Indicator: Dates outside this range (e.g., 2024-01-01 or 2019-05-15).
  4. Additional Attributes:

    Verify other details (e.g., barcode, packaging, quality) if available.


Python Implementation:

import datetime
class Product:
    def __init__(self, model, serial_number, manufacturing_date):
        self.model = model
        self.serial_number = serial_number
        self.manufacturing_date = manufacturing_date  # Format: "YYYY-MM-DD"
def is_fake(genuine_product, suspect_product):
    # Check model number
    if suspect_product.model != genuine_product.model:
        return True  # Fake: Model mismatch
    # Check serial number format
    if (len(suspect_product.serial_number) != 10 or 
        suspect_product.serial_number[0] != 'S' or 
        not suspect_product.serial_number[1:].isdigit()):
        return True  # Fake: Invalid serial format
    # Check manufacturing date
    try:
        mdate = datetime.datetime.strptime(suspect_product.manufacturing_date, '%Y-%m-%d').date()
    except ValueError:
        return True  # Fake: Invalid date format
    start_date = datetime.date(2020, 1, 1)
    end_date = datetime.date(2023, 12, 31)
    if mdate < start_date or mdate > end_date:
        return True  # Fake: Date out of range
    return False  # Genuine: All checks passed
genuine = Product(model="Genuine-X1", serial_number="S123456789", manufacturing_date="2021-05-15")
# Test Cases
suspect1 = Product(model="Fake-X1", serial_number="S123456789", manufacturing_date="2021-05-15")  # Fake (model)
suspect2 = Product(model="Genuine-X1", serial_number="S12345678", manufacturing_date="2021-05-15")  # Fake (serial)
suspect3 = Product(model="Genuine-X1", serial_number="S123456789", manufacturing_date="2024-01-01")  # Fake (date)
suspect4 = Product(model="Genuine-X1", serial_number="S123456789", manufacturing_date="2021-05-15")  # Genuine
print(is_fake(genuine, suspect1))  # Output: True
print(is_fake(genuine, suspect2))  # Output: True
print(is_fake(genuine, suspect3))  # Output: True
print(is_fake(genuine, suspect4))  # Output: False

How It Works:

  1. Model Check:
    Compares the suspect's model against the genuine product's model. A mismatch flags it as fake.

  2. Serial Number Validation:
    Ensures the serial number starts with S and has exactly 9 digits afterward. Any deviation indicates a fake.

  3. Manufacturing Date Verification:
    Converts the date string to a date object and checks if it falls within the valid range (2020-01-01 to 2023-12-31). Invalid formats or dates outside the range are flagged.

  4. Result:
    Returns True if any check fails (fake), False if all checks pass (genuine).


Enhancements for Real-World Use:

  • Barcode Validation: Use a library like pyzbar to scan barcodes and verify against a database.
  • Database Lookup: Cross-reference serial numbers with a manufacturer's database.
  • Machine Learning: Train a model on features like packaging quality, materials, or text patterns to detect fakes.
  • User Feedback: Allow users to report suspected fakes to refine the algorithm.

This test provides a foundational framework for identifying fake products by focusing on critical, verifiable attributes. Adjust checks based on specific product requirements and industry standards.


Request an On-site Audit / Inquiry

SSL Secured Inquiry