This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Encrypt blocks message must be divisible by block size if not there is a fix for it in this function but it is commented out for testing | |
public static Vector<BigInteger> encryptBlockText(String clearText, BigInteger p, BigInteger q, int BlockSize) { | |
BigInteger c = null; | |
String Blocks = null; | |
String block = null; | |
int payLoad = 0; | |
Vector<BigInteger> encryptedBlocks = new Vector<BigInteger>(); | |
Vector<BigInteger> publicKey = generatePublicKey(BlockSize,p,q); | |
// Check if we have a public key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Vector<String> decryptBlocksText(Vector<BigInteger> cipherTextBlocks, BigInteger p, BigInteger q) { | |
BigInteger n = null, m = null; | |
Vector<String> decryptedBlocks = new Vector<String>(); | |
Vector<BigInteger> publicKey = new Vector<BigInteger>(); | |
//publicKeys are at the end of the cipher blocks | |
publicKey.add(cipherTextBlocks.get(cipherTextBlocks.size()-1)); | |
publicKey.add(cipherTextBlocks.get(cipherTextBlocks.size()-2)); | |
//now remove from cipher text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Test encrypting decrypting multiple blocks | |
public static void testEncryptDecryptBlocks() { | |
System.out.println( "Running encryption/decryption of Blocks tests" ); | |
// Create a test | |
Vector<String> test = new Vector<String>(); | |
for (int i = 5; i < 11; ++i) { | |
test.add( randomString( (int)Math.pow(2, i) ) ); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class myAsyncCall extends AsyncTask<String, Void, String> { | |
//since this is executing asynchronously want to track local exception | |
private Exception ex; | |
//Also since this is not executing on the UI thread we need to get our own instance of UI threads context | |
private Context mContext; | |
//Base url to make api calls to | |
private String baseUrl = "http://api.openweathermap.org/data/2.5/"; | |
private String usrZip = null; | |
//Constants |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
WebView wv1; | |
Button btnCallWeather; | |
Button btnCallUrl; | |
AutoCompleteTextView acTxZip; | |
AutoCompleteTextView acTxtUrl; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mostly following tutorial from just put together into a script for less copy pasta | |
# http://www.hurryupandwait.io/blog/in-search-of-a-light-weight-windows-vagrant-box | |
# Automate Setting up VM for Vagrant | |
##TODO!: Wrap in try catch, finally blocks | |
#Make sure to set the Execution policy to unrestricted or | |
#something other than none or restricted | |
try | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Built application files | |
/*/build/ | |
build | |
# Crashlytics configuations | |
com_crashlytics_export_strings.xml | |
# Local configuration file (sdk path, etc) | |
local.properties |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void PlayVideoFromDisk() | |
{ | |
var videoView = FindViewById<VideoView> (Resource.Id.videoView1); | |
//The string concatenated at the end is just a path on the device storage | |
var videoPath = Environment.ExternalStorageDirectory.AbsolutePath+"/Download/One.mp4"; | |
videoView.SetVideoPath(videoPath); | |
videoView.RequestFocus(); | |
videoView.Start(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Whatever | |
{ | |
//Basic interface used | |
interface ICommunicator | |
{ | |
void UpdateInfo(string data); | |
} | |
public class MainActivity : Activity, ICommunicator | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param([string]$s="foo",[string]$d="foo") | |
Add-Type -A System.IO.Compression.FileSystem | |
[IO.Compression.ZipFile]::CreateFromDirectory(("{0}\\{1}" -f $pwd, $s) , ("{0}\\{1}.zip" -f $pwd, $d)) | |
#[IO.Compression.ZipFile]::ExtractToDirectory(("{0}\\{1}.zip" -f $pwd, $d), ("{0}\\{1}" -f $pwd, $s)) |
OlderNewer