What kind of hash/encryption is this? (Extracted Message Data from Iphone)
_dXgqa-ZRyQ0RPTlAdBhEmzFXNMyQW9RmMu-XBCI
This is an encoded contact name from the LINE messenger app extracted from an iphone. I don't have the pre-encoded data. I've tried some base64 but with no success.
Can anyone tell the kind of encoding by sight, or have any advice on how to go about finding out?
Appreciate any help anyone can give! Thanks
See also questions close to this topic
-
Create and Initialise Custom UITabBarItem Class
I am building an application with four
UITabBarItems
. They all should look the same. Instead of customising them in their respectiveUIViewController
, I am trying to build a customUITabBarItem
class and have theUITabBarItems
inherit from it.So far, this is the work I have done:
class CustomTabBarItem: UITabBarItem { func customiseTabBarItems() { // Customises the item on the tab bar // For normal state setTitleTextAttributes([NSAttributedStringKey.font : Fonts.small!, NSAttributedStringKey.foregroundColor: Colours.grey], for: .normal) // When highlighted setTitleTextAttributes([NSAttributedStringKey.font : Fonts.small!, NSAttributedStringKey.foregroundColor: Colours.white], for: .highlighted) } }
and I have set each
UITabBarItem
as a subclass of my 'CustomTabBarItem' in the storyboard.The issue, however, is that the functionality is not showing up for my
UITabBarItems
.Any advice?
-
Why is this Swift cryptography library so slow?
I came across this cryptographic library and it is extremely slow to do everything.
The owner gives a benchmark of 30 seconds to convert a private key to a public key.
The library is this an elliptic curve generator with signing and encryption: https://github.com/hyu2018/EllipticCurve
The owner had a conversation with another user, where he suspects it is his UINT256 implementation, however I do not see a problem with that either: https://github.com/hyu2018/EllipticCurve/issues/6
-
php $sql INSERT INTO not posting new MySQL row with struct Encodable String VALUES
Objective is to
INSERT INTO FUBARtable
theLoginName
andLoginEmail
variables from ios app LoginPage -> into new row of mysql database. Question is how to modify code, which now can insert new row withVALUES ("statictext", ...)
, so that it will insert new row with the variable USERvaluesVALUES (LoginName, ...)
:// This $sql WILL insert new row with static text USERvalues $sql = "INSERT INTO `FUBARtable`(`userName`, `userEmail`) VALUES ('statictext', 'statictext')"; // This $sql will NOT insert new row with variable USERvalues $sql = "INSERT INTO `FUBARtable`(`userName`, `userEmail`) VALUES (LoginName, LoginEmail)"; // per GIJOW comment String? changed to String struct USERvalues: Encodable { let LoginName: String let LoginEmail: String } // userInfo[username, email] passed from LoginPage var userInfo = ["Anonymous", "unknown"] let url = URL(string: "http://mysqlDatabase.com/insert.php")! var request = URLRequest(url: url) request.httpMethod = "POST" request.addValue("application/json", forHTTPHeaderField: "Content-Type") let Post = USERvalues(LoginName: self.userInfo[0], LoginEmail: self.userInfo[1]) do { let encodedPost = try JSONEncoder().encode(Post) request.httpBody = encodedPost } catch {} let session = URLSession.shared let task = session.dataTask(with: request) { (data, _, _) in guard let data = data else { return } do { print(Post) let json = try JSONSerialization.jsonObject(with: data, options: []) print(json) } catch {} } task.resume()
(applying GIJOW comment to remove ?) print(Post) prints out the correct userInfo values from the LoginPage:
USERvalues(LoginName: "Arthur Dent", LoginEmail: "improbabilitydrive@gmail.com")
-
Xcode 9 code sign error code 1
I have tried cleaning my build folder, deleting the provisioning and certificates for the app, deleting derived data, and manually managing signing yet no matter what I do, I cannot get the build to archive. I get one erorr in xcode:
/Users/jscotto/Library/Developer/Xcode/DerivedData/ionic-deep-links-cdaztiimhbiwroaimkxbkdasbvpy/Build/Products/Debug-iphoneos/ionic-deep-links.app: unknown error -1=ffffffffffffffff Command /usr/bin/codesign failed with exit code 1
I have no clue what could be causing this.
-
How to get section Header value From cell Swift
In my DidselectRowAt method I have a cell that I get using
let currentCell = tableView.cellForRow(at: indexPath) as! SongCell
However Mutilating this cell causes issues considering the table view Im in has multiple section Headers like this :
How Can I tell what section header my cell has so when I change the image on the right to gray , other cells in the tableview dont change? Thank you.
-
iOS 11 podcast app starts podcasts over at about 20 second mark
All of my client's podcasts start over around the twenty to forty second mark in the iTunes app after the iOS 11 update. iOS 10 player does not display this issue. No other player is known to demonstrate this issue and once the episode restarts it plays to the end without issue. The restart stays at same point in any given episode but I suspect it occurs farther in on longer episodes as if it is maybe at a certain percentage of the duration in.
FF and RW functions including dragging playhead all work.
iTunes podcast app does this restart whether or not the app is allowed to download the episode file.
We have been working unsuccessfully with Apple support for weeks and I thought I would pose this here as well.
Apple support have examined the mp3 files and the RSS feed and see no issues.
<enclosure url="http://example.com/audio/episodes/2018_04_18_1458_some-show.mp3" length="63773956" type="audio/mpeg"/> <pubDate>Wed, 18 Apr 2018 00:00:00 -0500</pubDate> <itunes:duration>1:06:25</itunes:duration>
Client lives and dies by Google Analytics stats so we route inbound requests for the MP3s using mod_rewrite in htaccess like so
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com [NC] RewriteRule ^audio/episodes/([^/\.]+).mp3$ /audio/episodes/google_analytics_mp3.php?mp3=$1&redirected=1 [L,QSA]
And testing has demonstrated that when the routing is removed the issue is not seen in previously unplayed episodes. Episodes which have previously been played continue to exhibit the issue.
google_analytics_mp3.php:
<?php include_once($_SERVER['DOCUMENT_ROOT']."/classDBI/classDBI.php"); include_once($_SERVER['DOCUMENT_ROOT']."/classDBI/google_analytics_api.php"); $e = new Episode; if (is_numeric($_REQUEST['mp3'])) { $id = intval($_REQUEST['mp3']); list($ep) = $e->retrieve("id = $id"); if ($ep) { $outcome = ga_send_pageview(basename($ep->audio_link), 'Site streaming: ' . $ep->google_title()); } } else if ($_REQUEST['redirected'] == 1) { $fileName = $_GET['mp3'] . '.mp3'; $fileLocation = $_SERVER['DOCUMENT_ROOT'].'/audio/episodes/'.$fileName; $etag = md5_file($fileName); $fileRedirect = '/audio/episodes/'.$fileName; if (file_exists($fileLocation)) { list($ep) = $e->retrieve("audio_link = 'audio/episodes/$fileName'"); $pageName = 'Direct access'; if ($ep) { $pageName .= ': ' . $ep->google_title(); } $size = filesize($fileLocation); $time = date('r', filemtime($fileLocation)); $fm = @fopen($fileLocation, 'rb'); if (!$fm) { header ("HTTP/1.1 505 Internal server error"); return; } $begin = 0; $end = $size - 1; if (isset($_SERVER['HTTP_RANGE'])) { if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) { $begin = intval($matches[1]); if (!empty($matches[2])) { $end = intval($matches[2]); } } } if (isset($_SERVER['HTTP_RANGE'])) { header('HTTP/1.1 206 Partial Content'); if ($begin == 0) { $outcome = ga_send_pageview($fileName, 'Streaming: ' . $pageName); } } else{ header('HTTP/1.1 200 OK'); $outcome = ga_send_pageview($fileName, $pageName); } header("Content-Transfer-Encoding: binary"); header('Content-Type: audio/mpeg'); header("Etag: $etag"); header('Cache-Control: public, must-revalidate, max-age=0'); header('Pragma: no-cache'); header('Accept-Ranges: bytes'); header('Content-Length:' . (($end - $begin) + 1)); header('Content-Disposition: inline; filename="'.$fileName.'"'); // 2018.01.14 changes if (isset($_SERVER['HTTP_RANGE'])) { header("Content-Range: bytes $begin-$end/$size"); } // END 2018.01.14 changes readfile($fileLocation); header("Last-Modified: $time"); $cur = $begin; fseek($fm, $begin, 0); while(!feof($fm) && $cur <= $end && (connection_status() == 0)) { print fread($fm, min(1024 * 16, ($end - $cur) + 1)); $cur += 1024 * 16; } exit(); } }
I feel pretty certain that I something about the way headers are handled is causing the restart issue but I can't find the error.
The following are headers from Chrome Dev panel on a request for an mp3. IP address altered as was name of file:
General Request URL: http://example.com/audio/episodes/2018_04_18_1458_some-show.mp3 Request Method: GET Status Code: 200 OK Remote Address: 205.196.xxx.xxx:80 Referrer Policy: no-referrer-when-downgrade Response Headers Accept-Ranges: bytes Cache-Control: public, must-revalidate, max-age=0 Connection: Keep-Alive Content-Disposition: inline; filename="2018_04_18_1458_some-show.mp3" Content-Length: 63773956 Content-Transfer-Encoding: binary Content-Type: audio/mpeg Date: Fri, 20 Apr 2018 16:27:57 GMT Etag: 7fe7b0375cd99ec4d928b1a8885bee81 Expires: Thu, 19 Nov 1981 08:52:00 GMT Keep-Alive: timeout=2, max=100 Pragma: no-cache Server: Apache Request Headers Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.9 Cache-Control: no-cache Connection: keep-alive Cookie: PHPSESSID=TYDy9IZXJwTCBlmXVmkHn0; _ga=GA1.2.904913110.1515511103; _gid=GA1.2.666994959.1523989189; __unam=739f578-160db803df3-1cf2ee83-70 Host: www.example.com Pragma: no-cache Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36
In case it helps here is google_analytics_api.php:
<?php define('GOOGLEACCOUNT', 'UA-xxxxxxxx-1'); define('GOOGLEDOMAIN', $_SERVER['HTTP_HOST']); function gaParseCookie() { if (isset($_COOKIE['_ga'])) { list($version, $domainDepth, $cid1, $cid2) = explode('.', $_COOKIE["_ga"], 4); $contents = array('version' => $version, 'domainDepth' => $domainDepth, 'cid' => $cid1 . '.' . $cid2); $cid = $contents['cid']; } else { $cid = gaGenerateUUID(); } return $cid; } function gaGenerateUUID() { return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) ); } function gaSendData($data) { $getString = 'https://ssl.google-analytics.com/collect'; $getString .= '?payload_data&'; $getString .= http_build_query($data); $options = array( CURLOPT_CUSTOMREQUEST =>"GET", CURLOPT_POST =>false, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => "", CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_MAXREDIRS => 10, ); $ch = curl_init( $getString ); curl_setopt_array( $ch, $options ); $result = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); if ($err) { mail('email@example.com', 'Analytics MP3 Error' . __FILE__, "$err\n\n$errmsg\n\n$header"); } curl_close( $ch ); return $result; } function ga_send_pageview($file, $title) { $data = array( 'v' => 1, 'tid' => GOOGLEACCOUNT, 'cid' => gaParseCookie(), 't' => 'pageview', 'dh' => GOOGLEDOMAIN, 'dp' => $file, 'dt' => $title ); if(strlen($_SERVER['HTTP_REFERER'])) { $data['utmr'] = $_SERVER['HTTP_REFERER']; } if (strlen($_SERVER['HTTP_USER_AGENT'])) { $data['ua'] = $_SERVER['HTTP_USER_AGENT']; } gaSendData($data); } function ga_send_event($category=null, $action=null, $label=null) { $data = array( 'v' => 1, 'tid' => GOOGLEACCOUNT, 'cid' => gaParseCookie(), 't' => 'event', 'ec' => $category, //Category (Required) 'ea' => $action, //Action (Required) 'el' => $label ); gaSendData($data); }
Any advice most appreciated!
-
Encrypt QR codes
I am developing an Android app and a web administration module. I need to generate QR codes, but encrypted (since these reveal sensitive information in the database).
The QR codes are generated in PHP and are read by the android app. I have been reviewing this documentation of Halite, which I think is very good.
https://github.com/paragonie/halite/blob/master/doc/Basic.md What is your counterpart in java android to decipher the message? Or what other alternative advise me to do this?
-
Java RSA key from RSAPrivateKeySpec javax.crypto.BadPaddingException: Decryption error
I have a RSA Code class without the Java Crypto Library. It works.
import java.math.BigInteger; import java.security.SecureRandom; import java.util.Random; public class RSA { public static RSAKeyPair generateKeyPair(int keysize) { Random rnd = new SecureRandom(); BigInteger p = new BigInteger(keysize / 2, 100, rnd); BigInteger q = new BigInteger(keysize / 2, 100, rnd); BigInteger n = p.multiply(q); BigInteger phi = p.subtract(BigInteger.ONE).multiply(q.subtract(BigInteger.ONE)); BigInteger e; do { e = new BigInteger(phi.bitLength(), rnd); } while (e.compareTo(BigInteger.ONE) <= 0 || e.compareTo(phi) >= 0 || !e.gcd(phi).equals(BigInteger.ONE)); BigInteger d = e.modInverse(phi); return new RSAKeyPair(new RSAPublicKey(e, n), new RSAPrivateKey(d, n), n); } public static BigInteger encrypt(BigInteger m, RSAPublicKey key) { return m.modPow(key.getPublicExponent(), key.getModulus()); } public static BigInteger decrypt(BigInteger c, RSAPrivateKey key) { return c.modPow(key.getPrivateExponent(), key.getModulus()); } } class RSAPublicKey { private BigInteger e; private BigInteger n; public RSAPublicKey(BigInteger e, BigInteger n) { this.e = e; this.n = n; } public BigInteger getPublicExponent() { return e; } public BigInteger getModulus() { return n; } } class RSAPrivateKey { private BigInteger d; private BigInteger n; public RSAPrivateKey(BigInteger d, BigInteger n) { this.d = d; this.n = n; } public BigInteger getPrivateExponent() { return d; } public BigInteger getModulus() { return n; } } class RSAKeyPair { private RSAPublicKey pub; private RSAPrivateKey priv; private BigInteger modulus; public RSAKeyPair(RSAPublicKey pub, RSAPrivateKey priv, BigInteger modulus) { this.pub = pub; this.priv = priv; this.modulus = modulus; } public RSAPublicKey getPublicKey() { return pub; } public RSAPrivateKey getPrivateKey() { return priv; } public BigInteger getModulus() { return modulus; } }
But when i create a Java Library PrivateKey from RSAPrivateKeySpec with a Modulus and Exponent from a RSAPrivateKey from the class and encrypt with the java crypto library a with the class encrypted BigInteger it throws a
javax.crypto.BadPaddingException: Decryption error
. here:RSAKeyPair pair = generateKeyPair(1024); BigInteger encrypted = encrypt(new BigInteger("123456789"), pair.getPublicKey()); KeyFactory factory = KeyFactory.getInstance("RSA"); RSAPrivateKeySpec privSpec = new RSAPrivateKeySpec(pair.getPrivateKey().getModulus(), pair.getPrivateKey().getPrivateExponent()); PrivateKey priv = factory.generatePrivate(privSpec); Cipher cip = Cipher.getInstance("RSA"); cip.init(Cipher.DECRYPT_MODE, priv); System.out.println(new BigInteger(cip.doFinal(encrypted.toByteArray())));
Why?
sorry for my bad english
-
OXID shop password encryption algorithm
I want to import all userdata from an existing oxid shop into another shop system. The requirement is that all users have to keep their passwords. My Idea is as follows:
- import all oxid users into the new plattform
- save the oxid passwords into a new field e.g. 'oldPassword' into the new plattform and the password field will remain empty
- reimplement the encryption algorithm from oxid within the new plattform
- each time a customer enters his credentials, I run the oxid algorithm and check if the result is equals the value of the field 'oldPassword'
- If true, then I save the password into the right field
My Problem is, I do not know how OXID encrypt passwords. I know that it is md5 but I do not know which Salt is used
Thank you in advance
-
Convert ASCII String to 7-bit GSM coding scheme
A simple routine i wrote for converting
ASCII
string to corresponding7-bit GSM
coding scheme:#include <stdio.h> #include <process.h> #include <stdbool.h> #include <string.h> #include <stdlib.h> #include <inttypes.h> /* convert ascii input string to 7-bit GSM alphabet */ bool ascii_to_gsm(const char* in, uint8_t len, uint8_t* out, uint8_t start_indx) { if (in == NULL || out == NULL || len == 0) return false; uint8_t nshift = 7; memcpy(out + start_indx, in, len); for (size_t i = 0; i < len - 1; i++) { nshift = (nshift == 255) ? 7 : nshift; uint16_t l = out[start_indx + i]; uint16_t h = out[start_indx + i + 1]; h = (h << nshift--) | l; out[start_indx + i] = h; out[start_indx + i + 1] = h >> 8; } return true; } int main() { char data[] = "ASCIIASCII"; uint8_t buff[sizeof(data) - 1]; memset(buff, 0, sizeof(buff)); ascii_to_gsm(data, sizeof(buff), buff, 0); for (size_t i = 0; i < sizeof(buff); i++) { printf("\n buff[%d]=%02x", i, buff[i]); } system("pause"); return 0; }
For strings like
ASCII
orTEST
it's working fine and output isC1E9309904
andD4E2940A
respectively.But for string
ASCIIASCII
some output byte is wrong:C1E930990C4E87498024
The result should be:
C1E930990C4E87C924
Don't know what part, i'm wrong.
Concepts about GSM coding can be found here.
I use this online encoder to compare results
-
StringBuilder and accent
I have a
StringBuilder
and I want to write a text containing accent to an csv file.Code:
StringBuilder strbr = new StringBuilder(); strbr.AppendLine("ù;é;à"); File.WriteAllText(filePath + ".csv", strbr.ToString());
But when I open my csv file, there is only:
é
The file "test.csv' correctly contain
ù;é;à
, but when I open it with Excel I have:Maybe I missed a header for Excel?