Skip to content

Instantly share code, notes, and snippets.

View joeolaoye's full-sized avatar

Joseph Olaoye joeolaoye

View GitHub Profile
@joeolaoye
joeolaoye / gist:109cbbf4ea940d446bfcd8c3e70a9592
Last active January 11, 2021 11:43
Canary Points Rates API
GET https://fxrate.staging-cpg.online/api/v1/fx?limit=1
@joeolaoye
joeolaoye / chat.css
Last active May 24, 2019 13:20
Public gists
/*
HTML is the language that describes how web content is formatted and presented.
CSS is the language that describes the appearance of that content.
The two languages—HTML and CSS—are independent of one another and should remain that way. CSS should not be written inside of an HTML document and vice versa.
There are a few common terms to CSS and how it targets elements in HTML and sets their appearance.
Selectors generally target an attribute value, such as an id or class value, or target the type of element, such as <h1> or <p>. Once an element is selected, a property determines the styles that will be applied to that element. So far we’ve selected an element with a selector and determined what style we’d like to apply with a property. Now we can determine the behavior of that property with a value.
@joeolaoye
joeolaoye / Starting out.txt
Created May 21, 2019 10:44
How to setup your device for coding.
Hello
If you're using a laptop for this class you probably want to setup Visual Studio Code(https://code.visualstudio.com/download), because familiarity with this tool in itself is an advantage.
If you're using an Android smartphone then you want to get Spck Editor(https://play.google.com/store/apps/details?id=io.spck&hl=en_CA&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1), you can read more about that here(https://spck-code-editor.readthedocs.io/en/latest/#android-app)
If you're using an iPhone, you can afford a laptop or you should.
Just kidding, if for some reason all you have is a device that can access the internet, you can use https://spck.io/ as your coding platform, it is full-featured.
@joeolaoye
joeolaoye / TripleDES.php
Created May 23, 2016 14:40
An encryption/decryption code in PHP
public function encrypt3Des($data, $key)
{
//Generate a key from a hash
$key = md5(utf8_encode($key), true);
//Take first 8 bytes of $key and append them to the end of $key.
$key .= substr($key, 0, 8);
//Pad for PKCS7
$blockSize = mcrypt_get_block_size('tripledes', 'ecb');
@joeolaoye
joeolaoye / TripleDES.java
Last active June 6, 2022 08:41
A class to encrypt and decrypt using 3DES in java
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
@joeolaoye
joeolaoye / gist:dd6dd66c23a53e3be8cc
Created March 10, 2016 10:47
TripleDES Encryption Hardner and Softner
public String harden(String unencryptedString) throws NoSuchAlgorithmException, UnsupportedEncodingException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
MessageDigest md = MessageDigest.getInstance("md5");
byte[] digestOfPassword = md.digest(key.getBytes("utf-8"));
byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);
for (int j = 0, k = 16; j < 8;) {
keyBytes[k++] = keyBytes[j++];
}
SecretKey secretKey = new SecretKeySpec(keyBytes, "DESede");