Skip to content

Instantly share code, notes, and snippets.

View sebastianknopf's full-sized avatar

Sebastian Knopf sebastianknopf

View GitHub Profile
@nojimage
nojimage / session_acl_component.php
Created January 14, 2011 11:12
CakePHP ACL Caching using Session
<?php
/**
* AclComponent using Session Cache for CakePHP 1.3
*
* Copyright 2011, nojimage (http://php-tips.com/)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
@turret-io
turret-io / verify_hmac.php
Last active July 29, 2024 03:13
Verify HMAC in PHP
<?php
define("SHARED_SECRET", "sup3rs3cr3t!!");
if(!function_exists('hash_equals')) {
function hash_equals($str1, $str2) {
// Run constant-time comparison for PHP < 5.6 which doesn't support hmac_equals
$str1_len = strlen($str1);
$str2_len = strlen($str2);
@spiritinlife
spiritinlife / HMAC.java
Created November 27, 2014 18:50
HMAC RETROFIT ANDROID
import android.util.Base64;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
public class HMAC {
public static String hmacDigest(String msg, String keyString, String algo) {
@DimazzzZ
DimazzzZ / iso-639-1-codes.php
Last active October 17, 2024 18:01 — forked from ddebin/iso_array_lang.php
ISO 639-1 language codes array
<?php
$codes = [
'ab' => 'Abkhazian',
'aa' => 'Afar',
'af' => 'Afrikaans',
'ak' => 'Akan',
'sq' => 'Albanian',
'am' => 'Amharic',
'ar' => 'Arabic',