Line data Source code
1 : //
2 : // Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com)
3 : //
4 : // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 : //
7 : // Official repository: https://github.com/cppalliance/capy
8 : //
9 :
10 : #include <boost/capy/bcrypt/error.hpp>
11 :
12 : namespace boost {
13 : namespace capy {
14 : namespace bcrypt {
15 : namespace detail {
16 :
17 : const char*
18 0 : error_cat_type::
19 : name() const noexcept
20 : {
21 0 : return "boost.capy.bcrypt";
22 : }
23 :
24 : std::string
25 2 : error_cat_type::
26 : message(int ev) const
27 : {
28 4 : return message(ev, nullptr, 0);
29 : }
30 :
31 : char const*
32 2 : error_cat_type::
33 : message(
34 : int ev,
35 : char*,
36 : std::size_t) const noexcept
37 : {
38 2 : switch(static_cast<error>(ev))
39 : {
40 0 : case error::ok: return "success";
41 1 : case error::invalid_salt: return "invalid salt";
42 1 : case error::invalid_hash: return "invalid hash";
43 0 : default:
44 0 : return "unknown";
45 : }
46 : }
47 :
48 : #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
49 : constinit error_cat_type error_cat;
50 : #else
51 : error_cat_type error_cat;
52 : #endif
53 :
54 : } // detail
55 : } // bcrypt
56 : } // capy
57 : } // boost
58 :
|