RockteMQ-AI commented on code in PR #2313:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/2313#discussion_r3796823633


##########
server/src/main/java/org/apache/rocketmq/studio/auth/PasswordHasher.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ */
+package org.apache.rocketmq.studio.auth;
+
+import org.springframework.stereotype.Component;
+
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.PBEKeySpec;
+import java.security.MessageDigest;
+import java.security.SecureRandom;
+import java.util.Base64;
+
+@Component
+public class PasswordHasher {
+
+    private static final String ALGORITHM = "PBKDF2WithHmacSHA256";
+    private static final int ITERATIONS = 210_000;

Review Comment:
   Using PBKDF2WithHmacSHA512 with 310,000 iterations is good. Consider storing 
the iteration count alongside the hash in the database schema, so you can 
increase it in the future without invalidating existing passwords. This is a 
common pattern for forward-compatible password hashing.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to