Skip to content

Instantly share code, notes, and snippets.

@davibennun
davibennun / func.md
Created October 22, 2024 18:31
non-linear transformation functions

Here are several examples of non-linear transformation functions that you can use to obfuscate numbers while preserving their relative order. Each function applies a different non-linear mathematical transformation to the input values. These transformations will make it more difficult to reverse engineer the original numbers.

1. Exponential Transformation

This function applies an exponential transformation with a base, making the values grow rapidly as the input increases.

function obfuscateExponential(arr) {
    const base = 1.2; // Base of the exponential growth

 const obfuscatedArr = arr.map(num => Math.pow(base, num));
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /opt/homebrew/etc/nginx/ssl/{{host}}.crt;
ssl_certificate_key /opt/homebrew/etc/nginx/ssl/{{host}}.key;
ssl_ciphers HIGH:!aNULL:!MD5;
# listen 80;
server_name {{host}};
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /opt/homebrew/etc/nginx/ssl/{{host}}.crt;
ssl_certificate_key /opt/homebrew/etc/nginx/ssl/{{host}}.key;
ssl_ciphers HIGH:!aNULL:!MD5;
# listen 80;
server_name {{host}};
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /opt/homebrew/etc/nginx/ssl/{{host}}.crt;
ssl_certificate_key /opt/homebrew/etc/nginx/ssl/{{host}}.key;
ssl_ciphers HIGH:!aNULL:!MD5;
# listen 80;
server_name {{host}};
<?php
//Usage
$jomashopEbayItemsRequest = new RequestItemsFromStore();
$jomashopEbayItemsRequest->setStore('jomashop');
$jomashopEbayItems = $jomashopEbayItemsRequest->getAllItems();
$worldOfWatchesEbayItemsRequest = new RequestItemsFromStore();
$jomashopEbayItemsRequest->setStore('woldofwatches');
$worldOfWatchesEbayItems = $jomashopEbayItemsRequest->getAllItems();
<?php
class RequestItemsFromStore {
public function __construct(){
$this->eBayService = new DavidSadler\Services\ShoppingService;
}
public function setStore($store){
$this->storeName = $store;
}
class RequestItemsFromStore {
public function __construct(){
$this->eBayService = new DavidSadler\Services\ShoppingService;
}
public function setStore($store){
$this->storeName = $store;
}