I am trying to call the Pho.to API to edit photos, and every time I try to POST I get the same error. I've double and triple checked my app_id
and my key
, and I can't figure out what I'm doing wrong. I'm currently using the ARC Chrome Extension to call this api, so I haven't even started coding that part yet, I'm just trying to get a real response back from the api to make sure it even works.
I followed the instructions in their docs as well as I could. Here's the link for reference: http://developers.pho.to/documentation/sending-requests
Here is my api call:
http://opeapi.ws.pho.to/addtask?APP_ID=<my-app-id>&KEY=<my-key>&SIGN_DATA=910ceb5bdb238b9248a34cce8b29ba64d5f239df
And here is the response I get back (don't be deceived by the 200):
Status: 200 OK<?xml version="1.0" ?><image_process_response> <status>SecurityError</status> <err_code>614</err_code> <description>Error in POST parameters: one or more parameters (DATA , SIGN_DATA or APP_ID) are empty</description></image_process_response>
Here's the PHP code I use to create the SHA1 for SIGN_DATA
:
<?php echo hash_hmac('SHA1', '<image_process_call><lang>en</lang><image_url order="1">http://www.w3schools.com/html/pic_mountain.jpg</image_url><methods_list><method order="1"><name>desaturation</name></method><method order="2"><name>cartoon</name><params>fill_solid_color=1;target_color=(255,255,255);border_strength=20;border_width=3</params></method></methods_list><result_format>png</result_format><result_size>600</result_size></image_process_call>','<my-key>');?>
Here is the xml from above, formatted for readability:
<image_process_call> <lang>en</lang> <image_url order="1">http://www.w3schools.com/html/pic_mountain.jpg</image_url> <methods_list> <method order="1"> <name>desaturation</name> </method> <method order="2"> <name>cartoon</name> <params>fill_solid_color=1;target_color=(255,255,255);border_strength=20;border_width=3</params> </method> </methods_list> <result_format>png</result_format> <result_size>600</result_size></image_process_call>
Any help would be appreciated. Thanks in advance!
As you know, SHA1 was broken last year (https://shattered.io).
But, in Azure IoT Hub and DPS SHA1 fingerprints are used to check that the device public key is reliable.
In theory, an attacker could find a pair private / public key values, different than the geniune, that would match with the genuine fingerprint stored on the IoT Hub / DPS.
Would that process suitable?Why not to upgrade anyway to SHA256?
Thanks in advance
I have been trying to generate an OAuth signature form the base_string
and consumer_secret
. I tried using OAuth.jl
but it gives me error oauth_signature does not match expected value
. I am aware that OAuth
uses MbedTLS.jl's
digest function to create a signature and I also tried using it in my own code but no success.
according to the specification: http://wiki.theory.org/BitTorrentSpecification
info_hash: urlencoded 20-byte SHA1 hash of the value of the info key from the Metainfo file. Note that the value will be a bencoded dictionary, given the definition of the info key above.
torrentMap
is my dictionary, I get the info
key which is another dictionary, I calculate the hash and I URLencode
it.
But I always get an invalid info_hash
message when I try to send it to the tracker.
This is my code:
public String GetInfo_hash() { String info_hash = ""; ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; try { out = new ObjectOutputStream(bos); out.writeObject(torrentMap.get("info")); byte[] bytes = bos.toByteArray(); //Map => byte[] MessageDigest md = MessageDigest.getInstance("SHA1"); info_hash = urlencode(md.digest(bytes)); //Hashing and URLEncoding out.close(); bos.close(); } catch (Exception ex) { } return info_hash;}private String urlencode(byte[] bs) { StringBuffer sb = new StringBuffer(bs.length * 3); for (int i = 0; i < bs.length; i++) { int c = bs[i] & 0xFF; sb.append('%'); if (c < 16) { sb.append('0'); } sb.append(Integer.toHexString(c)); } return sb.toString();}
The following is my code. I have been trying to fix the code to perform dictionary attack on a hash (SHA-1) and I am getting the following result.P.S. I am a beginner to coding.
import hashlibimport random#plug in the hash that needs to be crackedhash_to_crack = "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8"#direct the location of the dictionary filedict_file = "C:/Users/kiran/AppData/Local/Programs/Python/Python37/dictionary.txt"def main(): with open(dict_file) as fileobj: for line in fileobj: line = line.strip() if hashlib.sha1(line.encode()).hexdigest() == hash_to_crack: print ("The password is %s") % (line); return "" print ("Failed to crack the hash!") return ""if __name__ == "__main__": main()
The result:
RESTART: C:/Users/kiran/AppData/Local/Programs/Python/Python37/Codes/datest1.pyThe password is %sTraceback (most recent call last): File "C:/Users/kiran/AppData/Local/Programs/Python/Python37/Codes/datest1.py", line 20, in <module> main() File "C:/Users/kiran/AppData/Local/Programs/Python/Python37/Codes/datest1.py", line 13, in main print ("The password is %s") % (line);TypeError: unsupported operand type(s) for %: 'NoneType' and 'str'
Please note that by viewing our site you agree to our use of cookies (see Privacy for details). You will only see this message once.