ASP-FastBoard - Demo/Support-Forum
Forum anmelden / register Board
SearchSearch CalendarCalendar GalleryGalleryAuction-PortalAuctions GlobalGlobal Top-ListTopMembersMembers StatisticsStats
get your RSS-Feed
Language/Sprache:  Admin  
 Login: ChatChat (0) new User-MapUser-Mapsend Passwordsend Password RegisterRegister

Forum Overview » Homepagetools - Support » HTML/JavaScript/CSS » Java Script Änderung
Pages: (2) 1 [2] »
Registration necessaryRegistration necessary
Java Script Änderung
nahtasurbhi6no Access no Access no Access 
Group: User
Level: Neuling


Posts: 1
Joined: 6/20/2022
IP-Address: saved
offline


Trust this makes a difference:

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;

public class Test1 {

confidential static last String HMAC_SHA512 = "HmacSHA512";

public static void main(String[] args) {
Macintosh sha512Hmac;
String result;
last String key = "Welcome1";

attempt {
last byte[] byteKey = key.getBytes(StandardCharsets.UTF_8);
sha512Hmac = Mac.getInstance(HMAC_SHA512);
SecretKeySpec keySpec = new SecretKeySpec(byteKey, HMAC_SHA512);
sha512Hmac.init(keySpec);
byte[] macData = sha512Hmac.doFinal("My message".getBytes(StandardCharsets.UTF_8));

// Can either base64 encode or put it directly into hex
result = Base64.getEncoder().encodeToString(macData);
//result = bytesToHex(macData);
} get (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) {
e.printStackTrace();
} at long last {
// Put any cleanup here
System.out.println("Done");
}
}
}

Java Classes in Pune


6/20/2022 7:23:51 AM    
Registration necessaryRegistration necessary
Pages: (2) 1 [2] »
all Times are GMT +1:00
Thread-Info
AccessModerators
Reading: all
Writing: User
Group: general
none
Forum Overview » Homepagetools - Support » HTML/JavaScript/CSS » Java Script Änderung

.: Script-Time: 0.125 || SQL-Queries: 6 || Active-Users: 3,183 :.
Powered by ASP-FastBoard HE v0.8, hosted by cyberlord.at