jBCrypt 0.3 线程安全吗? [英] Is jBCrypt 0.3 threadsafe?

查看:34
本文介绍了jBCrypt 0.3 线程安全吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题说明了一切.代码可以在以下链接中找到 -> http://www.mindrot.org/projects/jBCrypt/

Question says it all really. Code can be found at the following link -> http://www.mindrot.org/projects/jBCrypt/

推荐答案

首先,它没有被记录为线程安全的,因此就所有意图和目的而言,它不是.而且,在进一步调查中,绝对不是:事实证明,虽然有一些实例字段,但没有暴露的 BCrypt 实例;它试图通过静态方法完成所有事情.它可能不是线程安全的.它足够小,假设您关心并且作者会接受,您可以提供一个补丁来简单地将其转换为提供单独的安全实例(编辑添加:我已经仔细擦洗并准备了一个更干净的版本,我将发送给作者...)

First, it's not documented as thread-safe, so for all intents and purposes, it's not. And, on further investigation, it's definitely not: It turns out that, while there are some instance fields, there is no instance of BCrypt exposed; it tries to do everything through static methods. It may not be thread safe. It's small enough that, assuming you care and the author would accept, you could offer a patch to trivially convert it to provide separate, safe instances (edit to add: I have scrubbed it carefully and prepared a cleaner version, which I will send to the author...)

第二,你想在多线程环境中以什么方式使用它?我不清楚你想在不同的线程中做什么.

Second, in what manner do you want to use this in a multithreaded environment? It's not clear to me what you'd want to do in separate threads.

注意:截至 2013 年 7 月 18 日,下面有反对意见,但有更多赞成票

NOTE: There is a dissenting opinion below with more upvotes as of 7/18/2013

这篇关于jBCrypt 0.3 线程安全吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆