authing_ruby 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/authing_ruby.gemspec +4 -2
- data/lib/authing_ruby/common/PublicKeyManager.rb +12 -1
- data/lib/authing_ruby/version.rb +1 -1
- metadata +10 -467
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/CONTRIBUTION.md +0 -23
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/LICENSE +0 -21
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/README.md +0 -303
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build-doc.js +0 -520
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/browser/index.min.js +0 -2
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/browser/index.min.js.LICENSE.txt +0 -91
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/index.d.ts +0 -7
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/index.js +0 -20
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/AuthenticationClient.d.ts +0 -1118
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/AuthenticationClient.js +0 -2859
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/AuthenticationTokenProvider.d.ts +0 -13
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/AuthenticationTokenProvider.js +0 -56
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/BaseAuthenticationClient.d.ts +0 -6
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/BaseAuthenticationClient.js +0 -31
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/EnterpriseAuthenticationClient.d.ts +0 -92
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/EnterpriseAuthenticationClient.js +0 -250
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/MfaAuthenticationClient.d.ts +0 -303
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/MfaAuthenticationClient.js +0 -665
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/QrCodeAuthenticationClient.d.ts +0 -232
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/QrCodeAuthenticationClient.js +0 -622
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/SocialAuthenticationClient.d.ts +0 -104
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/SocialAuthenticationClient.js +0 -180
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/types.d.ts +0 -341
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/types.js +0 -69
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/common/GraphqlClient.d.ts +0 -14
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/common/GraphqlClient.js +0 -127
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/common/HttpClient.d.ts +0 -19
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/common/HttpClient.js +0 -151
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/common/PublicKeyManager.d.ts +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/common/PublicKeyManager.js +0 -81
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/graphqlapi.d.ts +0 -121
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/graphqlapi.js +0 -2002
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/AclManagementClient.d.ts +0 -236
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/AclManagementClient.js +0 -863
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/AgreementManagementClient.d.ts +0 -65
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/AgreementManagementClient.js +0 -195
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/ApplicationsManagementClient.d.ts +0 -216
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/ApplicationsManagementClient.js +0 -533
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/GroupsManagementClient.d.ts +0 -188
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/GroupsManagementClient.js +0 -404
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/MFAManagementClient.d.ts +0 -58
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/MFAManagementClient.js +0 -126
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/ManagementClient.d.ts +0 -79
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/ManagementClient.js +0 -203
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/ManagementTokenProvider.d.ts +0 -39
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/ManagementTokenProvider.js +0 -159
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/OrgManagementClient.d.ts +0 -521
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/OrgManagementClient.js +0 -840
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/PoliciesManagementClient.d.ts +0 -304
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/PoliciesManagementClient.js +0 -512
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/RolesManagementClient.d.ts +0 -296
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/RolesManagementClient.js +0 -711
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/StatisticsManagementClient.d.ts +0 -56
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/StatisticsManagementClient.js +0 -198
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UdfManagementClient.d.ts +0 -146
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UdfManagementClient.js +0 -264
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UserActionManagementClient.d.ts +0 -44
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UserActionManagementClient.js +0 -106
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UserpoolManagementClient.d.ts +0 -142
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UserpoolManagementClient.js +0 -241
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UsersManagementClient.d.ts +0 -784
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UsersManagementClient.js +0 -1251
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/WhitelistManagementClient.d.ts +0 -114
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/WhitelistManagementClient.js +0 -259
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/types.d.ts +0 -992
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/types.js +0 -96
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/platform/express/index.d.ts +0 -30
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/platform/express/index.js +0 -126
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/testing-helper.d.ts +0 -31
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/testing-helper.js +0 -67
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/utils.d.ts +0 -53
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/utils.js +0 -343
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/version.d.ts +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/version.js +0 -5
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/types/graphql.v2.d.ts +0 -6241
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/types/graphql.v2.js +0 -251
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/types/index.d.ts +0 -7
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/types/index.js +0 -3
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/index.d.ts +0 -7
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/index.js +0 -8
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/AuthenticationClient.d.ts +0 -1118
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/AuthenticationClient.js +0 -2853
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/AuthenticationTokenProvider.d.ts +0 -13
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/AuthenticationTokenProvider.js +0 -53
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/BaseAuthenticationClient.d.ts +0 -6
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/BaseAuthenticationClient.js +0 -28
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/EnterpriseAuthenticationClient.d.ts +0 -92
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/EnterpriseAuthenticationClient.js +0 -247
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/MfaAuthenticationClient.d.ts +0 -303
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/MfaAuthenticationClient.js +0 -662
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/QrCodeAuthenticationClient.d.ts +0 -232
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/QrCodeAuthenticationClient.js +0 -619
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/SocialAuthenticationClient.d.ts +0 -104
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/SocialAuthenticationClient.js +0 -177
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/types.d.ts +0 -341
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/types.js +0 -66
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/common/GraphqlClient.d.ts +0 -14
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/common/GraphqlClient.js +0 -121
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/common/HttpClient.d.ts +0 -19
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/common/HttpClient.js +0 -145
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/common/PublicKeyManager.d.ts +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/common/PublicKeyManager.js +0 -78
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/graphqlapi.d.ts +0 -121
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/graphqlapi.js +0 -1999
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/AclManagementClient.d.ts +0 -236
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/AclManagementClient.js +0 -860
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/AgreementManagementClient.d.ts +0 -65
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/AgreementManagementClient.js +0 -192
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/ApplicationsManagementClient.d.ts +0 -216
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/ApplicationsManagementClient.js +0 -530
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/GroupsManagementClient.d.ts +0 -188
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/GroupsManagementClient.js +0 -401
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/MFAManagementClient.d.ts +0 -58
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/MFAManagementClient.js +0 -123
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/ManagementClient.d.ts +0 -79
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/ManagementClient.js +0 -197
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/ManagementTokenProvider.d.ts +0 -39
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/ManagementTokenProvider.js +0 -153
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/OrgManagementClient.d.ts +0 -521
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/OrgManagementClient.js +0 -818
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/PoliciesManagementClient.d.ts +0 -304
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/PoliciesManagementClient.js +0 -509
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/RolesManagementClient.d.ts +0 -296
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/RolesManagementClient.js +0 -708
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/StatisticsManagementClient.d.ts +0 -56
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/StatisticsManagementClient.js +0 -195
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UdfManagementClient.d.ts +0 -146
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UdfManagementClient.js +0 -261
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UserActionManagementClient.d.ts +0 -44
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UserActionManagementClient.js +0 -103
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UserpoolManagementClient.d.ts +0 -142
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UserpoolManagementClient.js +0 -238
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UsersManagementClient.d.ts +0 -784
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UsersManagementClient.js +0 -1248
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/WhitelistManagementClient.d.ts +0 -114
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/WhitelistManagementClient.js +0 -256
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/types.d.ts +0 -992
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/types.js +0 -93
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/platform/express/index.d.ts +0 -30
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/platform/express/index.js +0 -123
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/testing-helper.d.ts +0 -31
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/testing-helper.js +0 -62
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/utils.d.ts +0 -53
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/utils.js +0 -336
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/version.d.ts +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/version.js +0 -2
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/types/graphql.v2.d.ts +0 -6241
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/types/graphql.v2.js +0 -248
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/types/index.d.ts +0 -7
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/types/index.js +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/index.d.ts +0 -7
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/index.js +0 -30
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/AuthenticationClient.d.ts +0 -1118
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/AuthenticationClient.js +0 -2869
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/AuthenticationTokenProvider.d.ts +0 -13
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/AuthenticationTokenProvider.js +0 -66
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/BaseAuthenticationClient.d.ts +0 -6
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/BaseAuthenticationClient.js +0 -41
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/EnterpriseAuthenticationClient.d.ts +0 -92
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/EnterpriseAuthenticationClient.js +0 -260
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/MfaAuthenticationClient.d.ts +0 -303
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/MfaAuthenticationClient.js +0 -675
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/QrCodeAuthenticationClient.d.ts +0 -232
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/QrCodeAuthenticationClient.js +0 -632
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/SocialAuthenticationClient.d.ts +0 -104
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/SocialAuthenticationClient.js +0 -190
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/types.d.ts +0 -341
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/types.js +0 -79
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/common/GraphqlClient.d.ts +0 -14
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/common/GraphqlClient.js +0 -137
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/common/HttpClient.d.ts +0 -19
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/common/HttpClient.js +0 -161
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/common/PublicKeyManager.d.ts +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/common/PublicKeyManager.js +0 -91
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/graphqlapi.d.ts +0 -121
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/graphqlapi.js +0 -2012
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/AclManagementClient.d.ts +0 -236
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/AclManagementClient.js +0 -873
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/AgreementManagementClient.d.ts +0 -65
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/AgreementManagementClient.js +0 -205
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/ApplicationsManagementClient.d.ts +0 -216
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/ApplicationsManagementClient.js +0 -543
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/GroupsManagementClient.d.ts +0 -188
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/GroupsManagementClient.js +0 -414
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/MFAManagementClient.d.ts +0 -58
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/MFAManagementClient.js +0 -136
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/ManagementClient.d.ts +0 -79
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/ManagementClient.js +0 -213
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/ManagementTokenProvider.d.ts +0 -39
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/ManagementTokenProvider.js +0 -169
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/OrgManagementClient.d.ts +0 -521
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/OrgManagementClient.js +0 -850
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/PoliciesManagementClient.d.ts +0 -304
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/PoliciesManagementClient.js +0 -522
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/RolesManagementClient.d.ts +0 -296
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/RolesManagementClient.js +0 -721
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/StatisticsManagementClient.d.ts +0 -56
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/StatisticsManagementClient.js +0 -208
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UdfManagementClient.d.ts +0 -146
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UdfManagementClient.js +0 -274
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UserActionManagementClient.d.ts +0 -44
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UserActionManagementClient.js +0 -116
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UserpoolManagementClient.d.ts +0 -142
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UserpoolManagementClient.js +0 -251
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UsersManagementClient.d.ts +0 -784
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UsersManagementClient.js +0 -1261
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/WhitelistManagementClient.d.ts +0 -114
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/WhitelistManagementClient.js +0 -269
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/types.d.ts +0 -992
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/types.js +0 -106
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/platform/express/index.d.ts +0 -30
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/platform/express/index.js +0 -136
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/testing-helper.d.ts +0 -31
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/testing-helper.js +0 -77
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/utils.d.ts +0 -53
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/utils.js +0 -353
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/version.d.ts +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/version.js +0 -15
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/types/graphql.v2.d.ts +0 -6241
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/types/graphql.v2.js +0 -261
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/types/index.d.ts +0 -7
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/types/index.js +0 -13
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/CHANGELOG.md +0 -413
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/LICENSE +0 -19
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/README.md +0 -709
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/UPGRADE_GUIDE.md +0 -162
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/dist/axios.js +0 -1715
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/dist/axios.map +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/dist/axios.min.js +0 -3
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/dist/axios.min.map +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/index.d.ts +0 -157
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/index.js +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/adapters/README.md +0 -37
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/adapters/http.js +0 -279
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/adapters/xhr.js +0 -180
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/axios.js +0 -53
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/cancel/Cancel.js +0 -19
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/cancel/CancelToken.js +0 -57
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/cancel/isCancel.js +0 -5
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/Axios.js +0 -94
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/InterceptorManager.js +0 -52
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/README.md +0 -7
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/buildFullPath.js +0 -20
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/createError.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/dispatchRequest.js +0 -79
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/enhanceError.js +0 -42
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/mergeConfig.js +0 -73
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/settle.js +0 -25
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/transformData.js +0 -20
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/defaults.js +0 -97
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/README.md +0 -7
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/bind.js +0 -11
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/buildURL.js +0 -71
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/combineURLs.js +0 -14
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/cookies.js +0 -53
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -24
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -14
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -68
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/normalizeHeaderName.js +0 -12
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/parseHeaders.js +0 -53
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/spread.js +0 -27
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/utils.js +0 -344
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/package.json +0 -84
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/follow-redirects/LICENSE +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/follow-redirects/README.md +0 -155
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/follow-redirects/http.js +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/follow-redirects/https.js +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/follow-redirects/index.js +0 -322
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/follow-redirects/package.json +0 -60
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/package.json +0 -129
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/tests/index.html +0 -21
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/tsconfig.brower.json +0 -45
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/tsconfig.node.json +0 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/webpack.config.js +0 -41
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/CHANGELOG.md +0 -685
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/LICENSE +0 -19
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/README.md +0 -800
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/UPGRADE_GUIDE.md +0 -162
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/dist/axios.js +0 -1756
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/dist/axios.map +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/dist/axios.min.js +0 -3
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/dist/axios.min.map +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/index.d.ts +0 -161
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/index.js +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/adapters/README.md +0 -37
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/adapters/http.js +0 -303
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/adapters/xhr.js +0 -179
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/axios.js +0 -56
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/cancel/Cancel.js +0 -19
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/cancel/CancelToken.js +0 -57
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/cancel/isCancel.js +0 -5
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/Axios.js +0 -95
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/InterceptorManager.js +0 -52
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/README.md +0 -7
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/buildFullPath.js +0 -20
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/createError.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/dispatchRequest.js +0 -79
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/enhanceError.js +0 -42
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/mergeConfig.js +0 -87
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/settle.js +0 -25
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/transformData.js +0 -20
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/defaults.js +0 -98
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/README.md +0 -7
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/bind.js +0 -11
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/buildURL.js +0 -70
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/combineURLs.js +0 -14
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/cookies.js +0 -53
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -24
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -14
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/isAxiosError.js +0 -11
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -68
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/normalizeHeaderName.js +0 -12
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/parseHeaders.js +0 -53
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/spread.js +0 -27
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/utils.js +0 -351
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/package.json +0 -86
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/CONTRIBUTING.md +0 -28
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/LICENSE +0 -24
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/README.md +0 -249
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/aes.js +0 -234
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/bower.json +0 -35
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/cipher-core.js +0 -890
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/core.js +0 -797
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/crypto-js.js +0 -6059
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/docs/QuickStartGuide.wiki +0 -470
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/enc-base64.js +0 -136
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/enc-hex.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/enc-latin1.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/enc-utf16.js +0 -149
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/enc-utf8.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/evpkdf.js +0 -134
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/format-hex.js +0 -66
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/format-openssl.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-md5.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-ripemd160.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-sha1.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-sha224.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-sha256.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-sha3.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-sha384.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-sha512.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac.js +0 -143
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/index.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/lib-typedarrays.js +0 -76
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/md5.js +0 -268
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/mode-cfb.js +0 -80
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/mode-ctr-gladman.js +0 -116
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/mode-ctr.js +0 -58
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/mode-ecb.js +0 -40
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/mode-ofb.js +0 -54
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/package.json +0 -38
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pad-ansix923.js +0 -49
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pad-iso10126.js +0 -44
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pad-iso97971.js +0 -40
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pad-nopadding.js +0 -30
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pad-pkcs7.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pad-zeropadding.js +0 -47
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pbkdf2.js +0 -145
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/rabbit-legacy.js +0 -190
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/rabbit.js +0 -192
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/rc4.js +0 -139
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/ripemd160.js +0 -267
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/sha1.js +0 -150
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/sha224.js +0 -80
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/sha256.js +0 -199
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/sha3.js +0 -326
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/sha384.js +0 -83
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/sha512.js +0 -326
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/tripledes.js +0 -779
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/x64-core.js +0 -304
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/CHANGELOG.md +0 -395
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/LICENSE +0 -19
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/Makefile +0 -58
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/README.md +0 -368
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/karma.conf.js +0 -70
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/node.js +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/package.json +0 -43
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/src/browser.js +0 -195
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/src/debug.js +0 -225
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/src/index.js +0 -10
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/src/node.js +0 -186
- data/lib/authing_ruby/test/js_sdk_test/node_modules/dotenv/CHANGELOG.md +0 -210
- data/lib/authing_ruby/test/js_sdk_test/node_modules/dotenv/LICENSE +0 -23
- data/lib/authing_ruby/test/js_sdk_test/node_modules/dotenv/README.md +0 -275
- data/lib/authing_ruby/test/js_sdk_test/node_modules/dotenv/config.js +0 -11
- data/lib/authing_ruby/test/js_sdk_test/node_modules/dotenv/lib/cli-options.js +0 -13
- data/lib/authing_ruby/test/js_sdk_test/node_modules/dotenv/lib/env-options.js +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/dotenv/lib/main.js +0 -118
- data/lib/authing_ruby/test/js_sdk_test/node_modules/dotenv/package.json +0 -57
- data/lib/authing_ruby/test/js_sdk_test/node_modules/dotenv/types/index.d.ts +0 -59
- data/lib/authing_ruby/test/js_sdk_test/node_modules/dotenv/types/test.ts +0 -19
- data/lib/authing_ruby/test/js_sdk_test/node_modules/dotenv/types/tsconfig.json +0 -15
- data/lib/authing_ruby/test/js_sdk_test/node_modules/dotenv/types/tslint.json +0 -6
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/LICENSE +0 -18
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/README.md +0 -148
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/debug.js +0 -14
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/http.js +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/https.js +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/index.js +0 -531
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/package.json +0 -59
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/LICENSE.txt +0 -107
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/README.md +0 -192
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/bin/jsencrypt.js +0 -249
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/bin/jsencrypt.min.js +0 -2
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/bin/jsencrypt.min.js.LICENSE.txt +0 -8
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/JSEncrypt.d.ts +0 -116
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/JSEncrypt.js +0 -186
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/JSEncryptRSAKey.d.ts +0 -142
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/JSEncryptRSAKey.js +0 -315
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/index.d.ts +0 -3
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/index.js +0 -3
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/asn1.d.ts +0 -51
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/asn1.js +0 -565
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/base64.d.ts +0 -5
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/base64.js +0 -88
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/hex.d.ts +0 -3
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/hex.js +0 -64
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/int10.d.ts +0 -9
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/int10.js +0 -87
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/oids.d.ts +0 -9778
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/oids.js +0 -1962
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/base64.d.ts +0 -3
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/base64.js +0 -76
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/jsbn.d.ts +0 -98
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/jsbn.js +0 -1754
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/prng4.d.ts +0 -10
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/prng4.js +0 -46
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/rng.d.ts +0 -3
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/rng.js +0 -76
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/rsa.d.ts +0 -23
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/rsa.js +0 -373
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/util.d.ts +0 -7
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/util.js +0 -58
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsrsasign/asn1-1.0.js +0 -1593
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsrsasign/yahoo.js +0 -69
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/version.json +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/package.json +0 -49
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/Gruntfile.js +0 -78
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/LICENSE +0 -21
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/README.md +0 -55
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/bower.json +0 -20
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/build/jwt-decode.js +0 -125
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/build/jwt-decode.min.js +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/jwt-decode.html +0 -2
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/lib/atob.js +0 -38
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/lib/base64_url_decode.js +0 -33
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/lib/index.js +0 -26
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/package.json +0 -37
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/standalone.js +0 -16
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/test/tests.js +0 -53
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/test_harness.html +0 -29
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/testem.yml +0 -46
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/testem_dev.yml +0 -1
- data/lib/authing_ruby/test/js_sdk_test/node_modules/ms/index.js +0 -152
- data/lib/authing_ruby/test/js_sdk_test/node_modules/ms/license.md +0 -21
- data/lib/authing_ruby/test/js_sdk_test/node_modules/ms/package.json +0 -37
- data/lib/authing_ruby/test/js_sdk_test/node_modules/ms/readme.md +0 -51
@@ -1,76 +0,0 @@
|
|
1
|
-
import { int2char } from "./util";
|
2
|
-
var b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
3
|
-
var b64pad = "=";
|
4
|
-
export function hex2b64(h) {
|
5
|
-
var i;
|
6
|
-
var c;
|
7
|
-
var ret = "";
|
8
|
-
for (i = 0; i + 3 <= h.length; i += 3) {
|
9
|
-
c = parseInt(h.substring(i, i + 3), 16);
|
10
|
-
ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63);
|
11
|
-
}
|
12
|
-
if (i + 1 == h.length) {
|
13
|
-
c = parseInt(h.substring(i, i + 1), 16);
|
14
|
-
ret += b64map.charAt(c << 2);
|
15
|
-
}
|
16
|
-
else if (i + 2 == h.length) {
|
17
|
-
c = parseInt(h.substring(i, i + 2), 16);
|
18
|
-
ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4);
|
19
|
-
}
|
20
|
-
while ((ret.length & 3) > 0) {
|
21
|
-
ret += b64pad;
|
22
|
-
}
|
23
|
-
return ret;
|
24
|
-
}
|
25
|
-
// convert a base64 string to hex
|
26
|
-
export function b64tohex(s) {
|
27
|
-
var ret = "";
|
28
|
-
var i;
|
29
|
-
var k = 0; // b64 state, 0-3
|
30
|
-
var slop = 0;
|
31
|
-
for (i = 0; i < s.length; ++i) {
|
32
|
-
if (s.charAt(i) == b64pad) {
|
33
|
-
break;
|
34
|
-
}
|
35
|
-
var v = b64map.indexOf(s.charAt(i));
|
36
|
-
if (v < 0) {
|
37
|
-
continue;
|
38
|
-
}
|
39
|
-
if (k == 0) {
|
40
|
-
ret += int2char(v >> 2);
|
41
|
-
slop = v & 3;
|
42
|
-
k = 1;
|
43
|
-
}
|
44
|
-
else if (k == 1) {
|
45
|
-
ret += int2char((slop << 2) | (v >> 4));
|
46
|
-
slop = v & 0xf;
|
47
|
-
k = 2;
|
48
|
-
}
|
49
|
-
else if (k == 2) {
|
50
|
-
ret += int2char(slop);
|
51
|
-
ret += int2char(v >> 2);
|
52
|
-
slop = v & 3;
|
53
|
-
k = 3;
|
54
|
-
}
|
55
|
-
else {
|
56
|
-
ret += int2char((slop << 2) | (v >> 4));
|
57
|
-
ret += int2char(v & 0xf);
|
58
|
-
k = 0;
|
59
|
-
}
|
60
|
-
}
|
61
|
-
if (k == 1) {
|
62
|
-
ret += int2char(slop << 2);
|
63
|
-
}
|
64
|
-
return ret;
|
65
|
-
}
|
66
|
-
// convert a base64 string to a byte/number array
|
67
|
-
export function b64toBA(s) {
|
68
|
-
// piggyback on b64tohex for now, optimize later
|
69
|
-
var h = b64tohex(s);
|
70
|
-
var i;
|
71
|
-
var a = [];
|
72
|
-
for (i = 0; 2 * i < h.length; ++i) {
|
73
|
-
a[i] = parseInt(h.substring(2 * i, 2 * i + 2), 16);
|
74
|
-
}
|
75
|
-
return a;
|
76
|
-
}
|
@@ -1,98 +0,0 @@
|
|
1
|
-
import { SecureRandom } from "./rng";
|
2
|
-
export declare class BigInteger {
|
3
|
-
constructor(a: number | number[] | string, b?: number | SecureRandom, c?: number | SecureRandom);
|
4
|
-
toString(b: number): string;
|
5
|
-
protected negate(): BigInteger;
|
6
|
-
abs(): BigInteger;
|
7
|
-
compareTo(a: BigInteger): number;
|
8
|
-
bitLength(): number;
|
9
|
-
mod(a: BigInteger): BigInteger;
|
10
|
-
modPowInt(e: number, m: BigInteger): BigInteger;
|
11
|
-
protected clone(): BigInteger;
|
12
|
-
protected intValue(): number;
|
13
|
-
protected byteValue(): number;
|
14
|
-
protected shortValue(): number;
|
15
|
-
protected signum(): 0 | 1 | -1;
|
16
|
-
toByteArray(): number[];
|
17
|
-
protected equals(a: BigInteger): boolean;
|
18
|
-
protected min(a: BigInteger): BigInteger;
|
19
|
-
protected max(a: BigInteger): BigInteger;
|
20
|
-
protected and(a: BigInteger): BigInteger;
|
21
|
-
protected or(a: BigInteger): BigInteger;
|
22
|
-
protected xor(a: BigInteger): BigInteger;
|
23
|
-
protected andNot(a: BigInteger): BigInteger;
|
24
|
-
protected not(): BigInteger;
|
25
|
-
protected shiftLeft(n: number): BigInteger;
|
26
|
-
protected shiftRight(n: number): BigInteger;
|
27
|
-
protected getLowestSetBit(): number;
|
28
|
-
protected bitCount(): number;
|
29
|
-
protected testBit(n: number): boolean;
|
30
|
-
protected setBit(n: number): BigInteger;
|
31
|
-
protected clearBit(n: number): BigInteger;
|
32
|
-
protected flipBit(n: number): BigInteger;
|
33
|
-
add(a: BigInteger): BigInteger;
|
34
|
-
subtract(a: BigInteger): BigInteger;
|
35
|
-
multiply(a: BigInteger): BigInteger;
|
36
|
-
divide(a: BigInteger): BigInteger;
|
37
|
-
protected remainder(a: BigInteger): BigInteger;
|
38
|
-
protected divideAndRemainder(a: BigInteger): BigInteger[];
|
39
|
-
modPow(e: BigInteger, m: BigInteger): BigInteger;
|
40
|
-
modInverse(m: BigInteger): BigInteger;
|
41
|
-
protected pow(e: number): BigInteger;
|
42
|
-
gcd(a: BigInteger): BigInteger;
|
43
|
-
isProbablePrime(t: number): boolean;
|
44
|
-
copyTo(r: BigInteger): void;
|
45
|
-
fromInt(x: number): void;
|
46
|
-
protected fromString(s: string | number[], b: number): void;
|
47
|
-
clamp(): void;
|
48
|
-
dlShiftTo(n: number, r: BigInteger): void;
|
49
|
-
drShiftTo(n: number, r: BigInteger): void;
|
50
|
-
protected lShiftTo(n: number, r: BigInteger): void;
|
51
|
-
protected rShiftTo(n: number, r: BigInteger): void;
|
52
|
-
subTo(a: BigInteger, r: BigInteger): void;
|
53
|
-
multiplyTo(a: BigInteger, r: BigInteger): void;
|
54
|
-
squareTo(r: BigInteger): void;
|
55
|
-
divRemTo(m: BigInteger, q: BigInteger, r: BigInteger): void;
|
56
|
-
invDigit(): number;
|
57
|
-
protected isEven(): boolean;
|
58
|
-
protected exp(e: number, z: IReduction): BigInteger;
|
59
|
-
protected chunkSize(r: number): number;
|
60
|
-
protected toRadix(b: number): string;
|
61
|
-
fromRadix(s: string, b: number): void;
|
62
|
-
protected fromNumber(a: number, b: number | SecureRandom, c?: number | SecureRandom): void;
|
63
|
-
protected bitwiseTo(a: BigInteger, op: (a: number, b: number) => number, r: BigInteger): void;
|
64
|
-
protected changeBit(n: number, op: (a: number, b: number) => number): BigInteger;
|
65
|
-
protected addTo(a: BigInteger, r: BigInteger): void;
|
66
|
-
protected dMultiply(n: number): void;
|
67
|
-
dAddOffset(n: number, w: number): void;
|
68
|
-
multiplyLowerTo(a: BigInteger, n: number, r: BigInteger): void;
|
69
|
-
multiplyUpperTo(a: BigInteger, n: number, r: BigInteger): void;
|
70
|
-
protected modInt(n: number): number;
|
71
|
-
protected millerRabin(t: number): boolean;
|
72
|
-
protected square(): BigInteger;
|
73
|
-
gcda(a: BigInteger, callback: (x: BigInteger) => void): void;
|
74
|
-
fromNumberAsync(a: number, b: number | SecureRandom, c: number | SecureRandom, callback: () => void): void;
|
75
|
-
s: number;
|
76
|
-
t: number;
|
77
|
-
DB: number;
|
78
|
-
DM: number;
|
79
|
-
DV: number;
|
80
|
-
FV: number;
|
81
|
-
F1: number;
|
82
|
-
F2: number;
|
83
|
-
am: (i: number, x: number, w: BigInteger, j: number, c: number, n: number) => number;
|
84
|
-
[index: number]: number;
|
85
|
-
static ONE: BigInteger;
|
86
|
-
static ZERO: BigInteger;
|
87
|
-
}
|
88
|
-
export interface IReduction {
|
89
|
-
convert(x: BigInteger): BigInteger;
|
90
|
-
revert(x: BigInteger): BigInteger;
|
91
|
-
mulTo(x: BigInteger, y: BigInteger, r: BigInteger): void;
|
92
|
-
sqrTo(x: BigInteger, r: BigInteger): void;
|
93
|
-
}
|
94
|
-
export declare function nbi(): BigInteger;
|
95
|
-
export declare function parseBigInt(str: string, r: number): BigInteger;
|
96
|
-
export declare function intAt(s: string, i: number): number;
|
97
|
-
export declare function nbv(i: number): BigInteger;
|
98
|
-
export declare function nbits(x: number): number;
|
@@ -1,1754 +0,0 @@
|
|
1
|
-
// Copyright (c) 2005 Tom Wu
|
2
|
-
// All Rights Reserved.
|
3
|
-
// See "LICENSE" for details.
|
4
|
-
// Basic JavaScript BN library - subset useful for RSA encryption.
|
5
|
-
import { cbit, int2char, lbit, op_and, op_andnot, op_or, op_xor } from "./util";
|
6
|
-
// Bits per digit
|
7
|
-
var dbits;
|
8
|
-
// JavaScript engine analysis
|
9
|
-
var canary = 0xdeadbeefcafe;
|
10
|
-
var j_lm = ((canary & 0xffffff) == 0xefcafe);
|
11
|
-
//#region
|
12
|
-
var lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997];
|
13
|
-
var lplim = (1 << 26) / lowprimes[lowprimes.length - 1];
|
14
|
-
//#endregion
|
15
|
-
// (public) Constructor
|
16
|
-
var BigInteger = /** @class */ (function () {
|
17
|
-
function BigInteger(a, b, c) {
|
18
|
-
if (a != null) {
|
19
|
-
if ("number" == typeof a) {
|
20
|
-
this.fromNumber(a, b, c);
|
21
|
-
}
|
22
|
-
else if (b == null && "string" != typeof a) {
|
23
|
-
this.fromString(a, 256);
|
24
|
-
}
|
25
|
-
else {
|
26
|
-
this.fromString(a, b);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
}
|
30
|
-
//#region PUBLIC
|
31
|
-
// BigInteger.prototype.toString = bnToString;
|
32
|
-
// (public) return string representation in given radix
|
33
|
-
BigInteger.prototype.toString = function (b) {
|
34
|
-
if (this.s < 0) {
|
35
|
-
return "-" + this.negate().toString(b);
|
36
|
-
}
|
37
|
-
var k;
|
38
|
-
if (b == 16) {
|
39
|
-
k = 4;
|
40
|
-
}
|
41
|
-
else if (b == 8) {
|
42
|
-
k = 3;
|
43
|
-
}
|
44
|
-
else if (b == 2) {
|
45
|
-
k = 1;
|
46
|
-
}
|
47
|
-
else if (b == 32) {
|
48
|
-
k = 5;
|
49
|
-
}
|
50
|
-
else if (b == 4) {
|
51
|
-
k = 2;
|
52
|
-
}
|
53
|
-
else {
|
54
|
-
return this.toRadix(b);
|
55
|
-
}
|
56
|
-
var km = (1 << k) - 1;
|
57
|
-
var d;
|
58
|
-
var m = false;
|
59
|
-
var r = "";
|
60
|
-
var i = this.t;
|
61
|
-
var p = this.DB - (i * this.DB) % k;
|
62
|
-
if (i-- > 0) {
|
63
|
-
if (p < this.DB && (d = this[i] >> p) > 0) {
|
64
|
-
m = true;
|
65
|
-
r = int2char(d);
|
66
|
-
}
|
67
|
-
while (i >= 0) {
|
68
|
-
if (p < k) {
|
69
|
-
d = (this[i] & ((1 << p) - 1)) << (k - p);
|
70
|
-
d |= this[--i] >> (p += this.DB - k);
|
71
|
-
}
|
72
|
-
else {
|
73
|
-
d = (this[i] >> (p -= k)) & km;
|
74
|
-
if (p <= 0) {
|
75
|
-
p += this.DB;
|
76
|
-
--i;
|
77
|
-
}
|
78
|
-
}
|
79
|
-
if (d > 0) {
|
80
|
-
m = true;
|
81
|
-
}
|
82
|
-
if (m) {
|
83
|
-
r += int2char(d);
|
84
|
-
}
|
85
|
-
}
|
86
|
-
}
|
87
|
-
return m ? r : "0";
|
88
|
-
};
|
89
|
-
// BigInteger.prototype.negate = bnNegate;
|
90
|
-
// (public) -this
|
91
|
-
BigInteger.prototype.negate = function () {
|
92
|
-
var r = nbi();
|
93
|
-
BigInteger.ZERO.subTo(this, r);
|
94
|
-
return r;
|
95
|
-
};
|
96
|
-
// BigInteger.prototype.abs = bnAbs;
|
97
|
-
// (public) |this|
|
98
|
-
BigInteger.prototype.abs = function () {
|
99
|
-
return (this.s < 0) ? this.negate() : this;
|
100
|
-
};
|
101
|
-
// BigInteger.prototype.compareTo = bnCompareTo;
|
102
|
-
// (public) return + if this > a, - if this < a, 0 if equal
|
103
|
-
BigInteger.prototype.compareTo = function (a) {
|
104
|
-
var r = this.s - a.s;
|
105
|
-
if (r != 0) {
|
106
|
-
return r;
|
107
|
-
}
|
108
|
-
var i = this.t;
|
109
|
-
r = i - a.t;
|
110
|
-
if (r != 0) {
|
111
|
-
return (this.s < 0) ? -r : r;
|
112
|
-
}
|
113
|
-
while (--i >= 0) {
|
114
|
-
if ((r = this[i] - a[i]) != 0) {
|
115
|
-
return r;
|
116
|
-
}
|
117
|
-
}
|
118
|
-
return 0;
|
119
|
-
};
|
120
|
-
// BigInteger.prototype.bitLength = bnBitLength;
|
121
|
-
// (public) return the number of bits in "this"
|
122
|
-
BigInteger.prototype.bitLength = function () {
|
123
|
-
if (this.t <= 0) {
|
124
|
-
return 0;
|
125
|
-
}
|
126
|
-
return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));
|
127
|
-
};
|
128
|
-
// BigInteger.prototype.mod = bnMod;
|
129
|
-
// (public) this mod a
|
130
|
-
BigInteger.prototype.mod = function (a) {
|
131
|
-
var r = nbi();
|
132
|
-
this.abs().divRemTo(a, null, r);
|
133
|
-
if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {
|
134
|
-
a.subTo(r, r);
|
135
|
-
}
|
136
|
-
return r;
|
137
|
-
};
|
138
|
-
// BigInteger.prototype.modPowInt = bnModPowInt;
|
139
|
-
// (public) this^e % m, 0 <= e < 2^32
|
140
|
-
BigInteger.prototype.modPowInt = function (e, m) {
|
141
|
-
var z;
|
142
|
-
if (e < 256 || m.isEven()) {
|
143
|
-
z = new Classic(m);
|
144
|
-
}
|
145
|
-
else {
|
146
|
-
z = new Montgomery(m);
|
147
|
-
}
|
148
|
-
return this.exp(e, z);
|
149
|
-
};
|
150
|
-
// BigInteger.prototype.clone = bnClone;
|
151
|
-
// (public)
|
152
|
-
BigInteger.prototype.clone = function () {
|
153
|
-
var r = nbi();
|
154
|
-
this.copyTo(r);
|
155
|
-
return r;
|
156
|
-
};
|
157
|
-
// BigInteger.prototype.intValue = bnIntValue;
|
158
|
-
// (public) return value as integer
|
159
|
-
BigInteger.prototype.intValue = function () {
|
160
|
-
if (this.s < 0) {
|
161
|
-
if (this.t == 1) {
|
162
|
-
return this[0] - this.DV;
|
163
|
-
}
|
164
|
-
else if (this.t == 0) {
|
165
|
-
return -1;
|
166
|
-
}
|
167
|
-
}
|
168
|
-
else if (this.t == 1) {
|
169
|
-
return this[0];
|
170
|
-
}
|
171
|
-
else if (this.t == 0) {
|
172
|
-
return 0;
|
173
|
-
}
|
174
|
-
// assumes 16 < DB < 32
|
175
|
-
return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];
|
176
|
-
};
|
177
|
-
// BigInteger.prototype.byteValue = bnByteValue;
|
178
|
-
// (public) return value as byte
|
179
|
-
BigInteger.prototype.byteValue = function () {
|
180
|
-
return (this.t == 0) ? this.s : (this[0] << 24) >> 24;
|
181
|
-
};
|
182
|
-
// BigInteger.prototype.shortValue = bnShortValue;
|
183
|
-
// (public) return value as short (assumes DB>=16)
|
184
|
-
BigInteger.prototype.shortValue = function () {
|
185
|
-
return (this.t == 0) ? this.s : (this[0] << 16) >> 16;
|
186
|
-
};
|
187
|
-
// BigInteger.prototype.signum = bnSigNum;
|
188
|
-
// (public) 0 if this == 0, 1 if this > 0
|
189
|
-
BigInteger.prototype.signum = function () {
|
190
|
-
if (this.s < 0) {
|
191
|
-
return -1;
|
192
|
-
}
|
193
|
-
else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) {
|
194
|
-
return 0;
|
195
|
-
}
|
196
|
-
else {
|
197
|
-
return 1;
|
198
|
-
}
|
199
|
-
};
|
200
|
-
// BigInteger.prototype.toByteArray = bnToByteArray;
|
201
|
-
// (public) convert to bigendian byte array
|
202
|
-
BigInteger.prototype.toByteArray = function () {
|
203
|
-
var i = this.t;
|
204
|
-
var r = [];
|
205
|
-
r[0] = this.s;
|
206
|
-
var p = this.DB - (i * this.DB) % 8;
|
207
|
-
var d;
|
208
|
-
var k = 0;
|
209
|
-
if (i-- > 0) {
|
210
|
-
if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p) {
|
211
|
-
r[k++] = d | (this.s << (this.DB - p));
|
212
|
-
}
|
213
|
-
while (i >= 0) {
|
214
|
-
if (p < 8) {
|
215
|
-
d = (this[i] & ((1 << p) - 1)) << (8 - p);
|
216
|
-
d |= this[--i] >> (p += this.DB - 8);
|
217
|
-
}
|
218
|
-
else {
|
219
|
-
d = (this[i] >> (p -= 8)) & 0xff;
|
220
|
-
if (p <= 0) {
|
221
|
-
p += this.DB;
|
222
|
-
--i;
|
223
|
-
}
|
224
|
-
}
|
225
|
-
if ((d & 0x80) != 0) {
|
226
|
-
d |= -256;
|
227
|
-
}
|
228
|
-
if (k == 0 && (this.s & 0x80) != (d & 0x80)) {
|
229
|
-
++k;
|
230
|
-
}
|
231
|
-
if (k > 0 || d != this.s) {
|
232
|
-
r[k++] = d;
|
233
|
-
}
|
234
|
-
}
|
235
|
-
}
|
236
|
-
return r;
|
237
|
-
};
|
238
|
-
// BigInteger.prototype.equals = bnEquals;
|
239
|
-
BigInteger.prototype.equals = function (a) {
|
240
|
-
return (this.compareTo(a) == 0);
|
241
|
-
};
|
242
|
-
// BigInteger.prototype.min = bnMin;
|
243
|
-
BigInteger.prototype.min = function (a) {
|
244
|
-
return (this.compareTo(a) < 0) ? this : a;
|
245
|
-
};
|
246
|
-
// BigInteger.prototype.max = bnMax;
|
247
|
-
BigInteger.prototype.max = function (a) {
|
248
|
-
return (this.compareTo(a) > 0) ? this : a;
|
249
|
-
};
|
250
|
-
// BigInteger.prototype.and = bnAnd;
|
251
|
-
BigInteger.prototype.and = function (a) {
|
252
|
-
var r = nbi();
|
253
|
-
this.bitwiseTo(a, op_and, r);
|
254
|
-
return r;
|
255
|
-
};
|
256
|
-
// BigInteger.prototype.or = bnOr;
|
257
|
-
BigInteger.prototype.or = function (a) {
|
258
|
-
var r = nbi();
|
259
|
-
this.bitwiseTo(a, op_or, r);
|
260
|
-
return r;
|
261
|
-
};
|
262
|
-
// BigInteger.prototype.xor = bnXor;
|
263
|
-
BigInteger.prototype.xor = function (a) {
|
264
|
-
var r = nbi();
|
265
|
-
this.bitwiseTo(a, op_xor, r);
|
266
|
-
return r;
|
267
|
-
};
|
268
|
-
// BigInteger.prototype.andNot = bnAndNot;
|
269
|
-
BigInteger.prototype.andNot = function (a) {
|
270
|
-
var r = nbi();
|
271
|
-
this.bitwiseTo(a, op_andnot, r);
|
272
|
-
return r;
|
273
|
-
};
|
274
|
-
// BigInteger.prototype.not = bnNot;
|
275
|
-
// (public) ~this
|
276
|
-
BigInteger.prototype.not = function () {
|
277
|
-
var r = nbi();
|
278
|
-
for (var i = 0; i < this.t; ++i) {
|
279
|
-
r[i] = this.DM & ~this[i];
|
280
|
-
}
|
281
|
-
r.t = this.t;
|
282
|
-
r.s = ~this.s;
|
283
|
-
return r;
|
284
|
-
};
|
285
|
-
// BigInteger.prototype.shiftLeft = bnShiftLeft;
|
286
|
-
// (public) this << n
|
287
|
-
BigInteger.prototype.shiftLeft = function (n) {
|
288
|
-
var r = nbi();
|
289
|
-
if (n < 0) {
|
290
|
-
this.rShiftTo(-n, r);
|
291
|
-
}
|
292
|
-
else {
|
293
|
-
this.lShiftTo(n, r);
|
294
|
-
}
|
295
|
-
return r;
|
296
|
-
};
|
297
|
-
// BigInteger.prototype.shiftRight = bnShiftRight;
|
298
|
-
// (public) this >> n
|
299
|
-
BigInteger.prototype.shiftRight = function (n) {
|
300
|
-
var r = nbi();
|
301
|
-
if (n < 0) {
|
302
|
-
this.lShiftTo(-n, r);
|
303
|
-
}
|
304
|
-
else {
|
305
|
-
this.rShiftTo(n, r);
|
306
|
-
}
|
307
|
-
return r;
|
308
|
-
};
|
309
|
-
// BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;
|
310
|
-
// (public) returns index of lowest 1-bit (or -1 if none)
|
311
|
-
BigInteger.prototype.getLowestSetBit = function () {
|
312
|
-
for (var i = 0; i < this.t; ++i) {
|
313
|
-
if (this[i] != 0) {
|
314
|
-
return i * this.DB + lbit(this[i]);
|
315
|
-
}
|
316
|
-
}
|
317
|
-
if (this.s < 0) {
|
318
|
-
return this.t * this.DB;
|
319
|
-
}
|
320
|
-
return -1;
|
321
|
-
};
|
322
|
-
// BigInteger.prototype.bitCount = bnBitCount;
|
323
|
-
// (public) return number of set bits
|
324
|
-
BigInteger.prototype.bitCount = function () {
|
325
|
-
var r = 0;
|
326
|
-
var x = this.s & this.DM;
|
327
|
-
for (var i = 0; i < this.t; ++i) {
|
328
|
-
r += cbit(this[i] ^ x);
|
329
|
-
}
|
330
|
-
return r;
|
331
|
-
};
|
332
|
-
// BigInteger.prototype.testBit = bnTestBit;
|
333
|
-
// (public) true iff nth bit is set
|
334
|
-
BigInteger.prototype.testBit = function (n) {
|
335
|
-
var j = Math.floor(n / this.DB);
|
336
|
-
if (j >= this.t) {
|
337
|
-
return (this.s != 0);
|
338
|
-
}
|
339
|
-
return ((this[j] & (1 << (n % this.DB))) != 0);
|
340
|
-
};
|
341
|
-
// BigInteger.prototype.setBit = bnSetBit;
|
342
|
-
// (public) this | (1<<n)
|
343
|
-
BigInteger.prototype.setBit = function (n) {
|
344
|
-
return this.changeBit(n, op_or);
|
345
|
-
};
|
346
|
-
// BigInteger.prototype.clearBit = bnClearBit;
|
347
|
-
// (public) this & ~(1<<n)
|
348
|
-
BigInteger.prototype.clearBit = function (n) {
|
349
|
-
return this.changeBit(n, op_andnot);
|
350
|
-
};
|
351
|
-
// BigInteger.prototype.flipBit = bnFlipBit;
|
352
|
-
// (public) this ^ (1<<n)
|
353
|
-
BigInteger.prototype.flipBit = function (n) {
|
354
|
-
return this.changeBit(n, op_xor);
|
355
|
-
};
|
356
|
-
// BigInteger.prototype.add = bnAdd;
|
357
|
-
// (public) this + a
|
358
|
-
BigInteger.prototype.add = function (a) {
|
359
|
-
var r = nbi();
|
360
|
-
this.addTo(a, r);
|
361
|
-
return r;
|
362
|
-
};
|
363
|
-
// BigInteger.prototype.subtract = bnSubtract;
|
364
|
-
// (public) this - a
|
365
|
-
BigInteger.prototype.subtract = function (a) {
|
366
|
-
var r = nbi();
|
367
|
-
this.subTo(a, r);
|
368
|
-
return r;
|
369
|
-
};
|
370
|
-
// BigInteger.prototype.multiply = bnMultiply;
|
371
|
-
// (public) this * a
|
372
|
-
BigInteger.prototype.multiply = function (a) {
|
373
|
-
var r = nbi();
|
374
|
-
this.multiplyTo(a, r);
|
375
|
-
return r;
|
376
|
-
};
|
377
|
-
// BigInteger.prototype.divide = bnDivide;
|
378
|
-
// (public) this / a
|
379
|
-
BigInteger.prototype.divide = function (a) {
|
380
|
-
var r = nbi();
|
381
|
-
this.divRemTo(a, r, null);
|
382
|
-
return r;
|
383
|
-
};
|
384
|
-
// BigInteger.prototype.remainder = bnRemainder;
|
385
|
-
// (public) this % a
|
386
|
-
BigInteger.prototype.remainder = function (a) {
|
387
|
-
var r = nbi();
|
388
|
-
this.divRemTo(a, null, r);
|
389
|
-
return r;
|
390
|
-
};
|
391
|
-
// BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;
|
392
|
-
// (public) [this/a,this%a]
|
393
|
-
BigInteger.prototype.divideAndRemainder = function (a) {
|
394
|
-
var q = nbi();
|
395
|
-
var r = nbi();
|
396
|
-
this.divRemTo(a, q, r);
|
397
|
-
return [q, r];
|
398
|
-
};
|
399
|
-
// BigInteger.prototype.modPow = bnModPow;
|
400
|
-
// (public) this^e % m (HAC 14.85)
|
401
|
-
BigInteger.prototype.modPow = function (e, m) {
|
402
|
-
var i = e.bitLength();
|
403
|
-
var k;
|
404
|
-
var r = nbv(1);
|
405
|
-
var z;
|
406
|
-
if (i <= 0) {
|
407
|
-
return r;
|
408
|
-
}
|
409
|
-
else if (i < 18) {
|
410
|
-
k = 1;
|
411
|
-
}
|
412
|
-
else if (i < 48) {
|
413
|
-
k = 3;
|
414
|
-
}
|
415
|
-
else if (i < 144) {
|
416
|
-
k = 4;
|
417
|
-
}
|
418
|
-
else if (i < 768) {
|
419
|
-
k = 5;
|
420
|
-
}
|
421
|
-
else {
|
422
|
-
k = 6;
|
423
|
-
}
|
424
|
-
if (i < 8) {
|
425
|
-
z = new Classic(m);
|
426
|
-
}
|
427
|
-
else if (m.isEven()) {
|
428
|
-
z = new Barrett(m);
|
429
|
-
}
|
430
|
-
else {
|
431
|
-
z = new Montgomery(m);
|
432
|
-
}
|
433
|
-
// precomputation
|
434
|
-
var g = [];
|
435
|
-
var n = 3;
|
436
|
-
var k1 = k - 1;
|
437
|
-
var km = (1 << k) - 1;
|
438
|
-
g[1] = z.convert(this);
|
439
|
-
if (k > 1) {
|
440
|
-
var g2 = nbi();
|
441
|
-
z.sqrTo(g[1], g2);
|
442
|
-
while (n <= km) {
|
443
|
-
g[n] = nbi();
|
444
|
-
z.mulTo(g2, g[n - 2], g[n]);
|
445
|
-
n += 2;
|
446
|
-
}
|
447
|
-
}
|
448
|
-
var j = e.t - 1;
|
449
|
-
var w;
|
450
|
-
var is1 = true;
|
451
|
-
var r2 = nbi();
|
452
|
-
var t;
|
453
|
-
i = nbits(e[j]) - 1;
|
454
|
-
while (j >= 0) {
|
455
|
-
if (i >= k1) {
|
456
|
-
w = (e[j] >> (i - k1)) & km;
|
457
|
-
}
|
458
|
-
else {
|
459
|
-
w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);
|
460
|
-
if (j > 0) {
|
461
|
-
w |= e[j - 1] >> (this.DB + i - k1);
|
462
|
-
}
|
463
|
-
}
|
464
|
-
n = k;
|
465
|
-
while ((w & 1) == 0) {
|
466
|
-
w >>= 1;
|
467
|
-
--n;
|
468
|
-
}
|
469
|
-
if ((i -= n) < 0) {
|
470
|
-
i += this.DB;
|
471
|
-
--j;
|
472
|
-
}
|
473
|
-
if (is1) { // ret == 1, don't bother squaring or multiplying it
|
474
|
-
g[w].copyTo(r);
|
475
|
-
is1 = false;
|
476
|
-
}
|
477
|
-
else {
|
478
|
-
while (n > 1) {
|
479
|
-
z.sqrTo(r, r2);
|
480
|
-
z.sqrTo(r2, r);
|
481
|
-
n -= 2;
|
482
|
-
}
|
483
|
-
if (n > 0) {
|
484
|
-
z.sqrTo(r, r2);
|
485
|
-
}
|
486
|
-
else {
|
487
|
-
t = r;
|
488
|
-
r = r2;
|
489
|
-
r2 = t;
|
490
|
-
}
|
491
|
-
z.mulTo(r2, g[w], r);
|
492
|
-
}
|
493
|
-
while (j >= 0 && (e[j] & (1 << i)) == 0) {
|
494
|
-
z.sqrTo(r, r2);
|
495
|
-
t = r;
|
496
|
-
r = r2;
|
497
|
-
r2 = t;
|
498
|
-
if (--i < 0) {
|
499
|
-
i = this.DB - 1;
|
500
|
-
--j;
|
501
|
-
}
|
502
|
-
}
|
503
|
-
}
|
504
|
-
return z.revert(r);
|
505
|
-
};
|
506
|
-
// BigInteger.prototype.modInverse = bnModInverse;
|
507
|
-
// (public) 1/this % m (HAC 14.61)
|
508
|
-
BigInteger.prototype.modInverse = function (m) {
|
509
|
-
var ac = m.isEven();
|
510
|
-
if ((this.isEven() && ac) || m.signum() == 0) {
|
511
|
-
return BigInteger.ZERO;
|
512
|
-
}
|
513
|
-
var u = m.clone();
|
514
|
-
var v = this.clone();
|
515
|
-
var a = nbv(1);
|
516
|
-
var b = nbv(0);
|
517
|
-
var c = nbv(0);
|
518
|
-
var d = nbv(1);
|
519
|
-
while (u.signum() != 0) {
|
520
|
-
while (u.isEven()) {
|
521
|
-
u.rShiftTo(1, u);
|
522
|
-
if (ac) {
|
523
|
-
if (!a.isEven() || !b.isEven()) {
|
524
|
-
a.addTo(this, a);
|
525
|
-
b.subTo(m, b);
|
526
|
-
}
|
527
|
-
a.rShiftTo(1, a);
|
528
|
-
}
|
529
|
-
else if (!b.isEven()) {
|
530
|
-
b.subTo(m, b);
|
531
|
-
}
|
532
|
-
b.rShiftTo(1, b);
|
533
|
-
}
|
534
|
-
while (v.isEven()) {
|
535
|
-
v.rShiftTo(1, v);
|
536
|
-
if (ac) {
|
537
|
-
if (!c.isEven() || !d.isEven()) {
|
538
|
-
c.addTo(this, c);
|
539
|
-
d.subTo(m, d);
|
540
|
-
}
|
541
|
-
c.rShiftTo(1, c);
|
542
|
-
}
|
543
|
-
else if (!d.isEven()) {
|
544
|
-
d.subTo(m, d);
|
545
|
-
}
|
546
|
-
d.rShiftTo(1, d);
|
547
|
-
}
|
548
|
-
if (u.compareTo(v) >= 0) {
|
549
|
-
u.subTo(v, u);
|
550
|
-
if (ac) {
|
551
|
-
a.subTo(c, a);
|
552
|
-
}
|
553
|
-
b.subTo(d, b);
|
554
|
-
}
|
555
|
-
else {
|
556
|
-
v.subTo(u, v);
|
557
|
-
if (ac) {
|
558
|
-
c.subTo(a, c);
|
559
|
-
}
|
560
|
-
d.subTo(b, d);
|
561
|
-
}
|
562
|
-
}
|
563
|
-
if (v.compareTo(BigInteger.ONE) != 0) {
|
564
|
-
return BigInteger.ZERO;
|
565
|
-
}
|
566
|
-
if (d.compareTo(m) >= 0) {
|
567
|
-
return d.subtract(m);
|
568
|
-
}
|
569
|
-
if (d.signum() < 0) {
|
570
|
-
d.addTo(m, d);
|
571
|
-
}
|
572
|
-
else {
|
573
|
-
return d;
|
574
|
-
}
|
575
|
-
if (d.signum() < 0) {
|
576
|
-
return d.add(m);
|
577
|
-
}
|
578
|
-
else {
|
579
|
-
return d;
|
580
|
-
}
|
581
|
-
};
|
582
|
-
// BigInteger.prototype.pow = bnPow;
|
583
|
-
// (public) this^e
|
584
|
-
BigInteger.prototype.pow = function (e) {
|
585
|
-
return this.exp(e, new NullExp());
|
586
|
-
};
|
587
|
-
// BigInteger.prototype.gcd = bnGCD;
|
588
|
-
// (public) gcd(this,a) (HAC 14.54)
|
589
|
-
BigInteger.prototype.gcd = function (a) {
|
590
|
-
var x = (this.s < 0) ? this.negate() : this.clone();
|
591
|
-
var y = (a.s < 0) ? a.negate() : a.clone();
|
592
|
-
if (x.compareTo(y) < 0) {
|
593
|
-
var t = x;
|
594
|
-
x = y;
|
595
|
-
y = t;
|
596
|
-
}
|
597
|
-
var i = x.getLowestSetBit();
|
598
|
-
var g = y.getLowestSetBit();
|
599
|
-
if (g < 0) {
|
600
|
-
return x;
|
601
|
-
}
|
602
|
-
if (i < g) {
|
603
|
-
g = i;
|
604
|
-
}
|
605
|
-
if (g > 0) {
|
606
|
-
x.rShiftTo(g, x);
|
607
|
-
y.rShiftTo(g, y);
|
608
|
-
}
|
609
|
-
while (x.signum() > 0) {
|
610
|
-
if ((i = x.getLowestSetBit()) > 0) {
|
611
|
-
x.rShiftTo(i, x);
|
612
|
-
}
|
613
|
-
if ((i = y.getLowestSetBit()) > 0) {
|
614
|
-
y.rShiftTo(i, y);
|
615
|
-
}
|
616
|
-
if (x.compareTo(y) >= 0) {
|
617
|
-
x.subTo(y, x);
|
618
|
-
x.rShiftTo(1, x);
|
619
|
-
}
|
620
|
-
else {
|
621
|
-
y.subTo(x, y);
|
622
|
-
y.rShiftTo(1, y);
|
623
|
-
}
|
624
|
-
}
|
625
|
-
if (g > 0) {
|
626
|
-
y.lShiftTo(g, y);
|
627
|
-
}
|
628
|
-
return y;
|
629
|
-
};
|
630
|
-
// BigInteger.prototype.isProbablePrime = bnIsProbablePrime;
|
631
|
-
// (public) test primality with certainty >= 1-.5^t
|
632
|
-
BigInteger.prototype.isProbablePrime = function (t) {
|
633
|
-
var i;
|
634
|
-
var x = this.abs();
|
635
|
-
if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {
|
636
|
-
for (i = 0; i < lowprimes.length; ++i) {
|
637
|
-
if (x[0] == lowprimes[i]) {
|
638
|
-
return true;
|
639
|
-
}
|
640
|
-
}
|
641
|
-
return false;
|
642
|
-
}
|
643
|
-
if (x.isEven()) {
|
644
|
-
return false;
|
645
|
-
}
|
646
|
-
i = 1;
|
647
|
-
while (i < lowprimes.length) {
|
648
|
-
var m = lowprimes[i];
|
649
|
-
var j = i + 1;
|
650
|
-
while (j < lowprimes.length && m < lplim) {
|
651
|
-
m *= lowprimes[j++];
|
652
|
-
}
|
653
|
-
m = x.modInt(m);
|
654
|
-
while (i < j) {
|
655
|
-
if (m % lowprimes[i++] == 0) {
|
656
|
-
return false;
|
657
|
-
}
|
658
|
-
}
|
659
|
-
}
|
660
|
-
return x.millerRabin(t);
|
661
|
-
};
|
662
|
-
//#endregion PUBLIC
|
663
|
-
//#region PROTECTED
|
664
|
-
// BigInteger.prototype.copyTo = bnpCopyTo;
|
665
|
-
// (protected) copy this to r
|
666
|
-
BigInteger.prototype.copyTo = function (r) {
|
667
|
-
for (var i = this.t - 1; i >= 0; --i) {
|
668
|
-
r[i] = this[i];
|
669
|
-
}
|
670
|
-
r.t = this.t;
|
671
|
-
r.s = this.s;
|
672
|
-
};
|
673
|
-
// BigInteger.prototype.fromInt = bnpFromInt;
|
674
|
-
// (protected) set from integer value x, -DV <= x < DV
|
675
|
-
BigInteger.prototype.fromInt = function (x) {
|
676
|
-
this.t = 1;
|
677
|
-
this.s = (x < 0) ? -1 : 0;
|
678
|
-
if (x > 0) {
|
679
|
-
this[0] = x;
|
680
|
-
}
|
681
|
-
else if (x < -1) {
|
682
|
-
this[0] = x + this.DV;
|
683
|
-
}
|
684
|
-
else {
|
685
|
-
this.t = 0;
|
686
|
-
}
|
687
|
-
};
|
688
|
-
// BigInteger.prototype.fromString = bnpFromString;
|
689
|
-
// (protected) set from string and radix
|
690
|
-
BigInteger.prototype.fromString = function (s, b) {
|
691
|
-
var k;
|
692
|
-
if (b == 16) {
|
693
|
-
k = 4;
|
694
|
-
}
|
695
|
-
else if (b == 8) {
|
696
|
-
k = 3;
|
697
|
-
}
|
698
|
-
else if (b == 256) {
|
699
|
-
k = 8;
|
700
|
-
/* byte array */
|
701
|
-
}
|
702
|
-
else if (b == 2) {
|
703
|
-
k = 1;
|
704
|
-
}
|
705
|
-
else if (b == 32) {
|
706
|
-
k = 5;
|
707
|
-
}
|
708
|
-
else if (b == 4) {
|
709
|
-
k = 2;
|
710
|
-
}
|
711
|
-
else {
|
712
|
-
this.fromRadix(s, b);
|
713
|
-
return;
|
714
|
-
}
|
715
|
-
this.t = 0;
|
716
|
-
this.s = 0;
|
717
|
-
var i = s.length;
|
718
|
-
var mi = false;
|
719
|
-
var sh = 0;
|
720
|
-
while (--i >= 0) {
|
721
|
-
var x = (k == 8) ? (+s[i]) & 0xff : intAt(s, i);
|
722
|
-
if (x < 0) {
|
723
|
-
if (s.charAt(i) == "-") {
|
724
|
-
mi = true;
|
725
|
-
}
|
726
|
-
continue;
|
727
|
-
}
|
728
|
-
mi = false;
|
729
|
-
if (sh == 0) {
|
730
|
-
this[this.t++] = x;
|
731
|
-
}
|
732
|
-
else if (sh + k > this.DB) {
|
733
|
-
this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;
|
734
|
-
this[this.t++] = (x >> (this.DB - sh));
|
735
|
-
}
|
736
|
-
else {
|
737
|
-
this[this.t - 1] |= x << sh;
|
738
|
-
}
|
739
|
-
sh += k;
|
740
|
-
if (sh >= this.DB) {
|
741
|
-
sh -= this.DB;
|
742
|
-
}
|
743
|
-
}
|
744
|
-
if (k == 8 && ((+s[0]) & 0x80) != 0) {
|
745
|
-
this.s = -1;
|
746
|
-
if (sh > 0) {
|
747
|
-
this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;
|
748
|
-
}
|
749
|
-
}
|
750
|
-
this.clamp();
|
751
|
-
if (mi) {
|
752
|
-
BigInteger.ZERO.subTo(this, this);
|
753
|
-
}
|
754
|
-
};
|
755
|
-
// BigInteger.prototype.clamp = bnpClamp;
|
756
|
-
// (protected) clamp off excess high words
|
757
|
-
BigInteger.prototype.clamp = function () {
|
758
|
-
var c = this.s & this.DM;
|
759
|
-
while (this.t > 0 && this[this.t - 1] == c) {
|
760
|
-
--this.t;
|
761
|
-
}
|
762
|
-
};
|
763
|
-
// BigInteger.prototype.dlShiftTo = bnpDLShiftTo;
|
764
|
-
// (protected) r = this << n*DB
|
765
|
-
BigInteger.prototype.dlShiftTo = function (n, r) {
|
766
|
-
var i;
|
767
|
-
for (i = this.t - 1; i >= 0; --i) {
|
768
|
-
r[i + n] = this[i];
|
769
|
-
}
|
770
|
-
for (i = n - 1; i >= 0; --i) {
|
771
|
-
r[i] = 0;
|
772
|
-
}
|
773
|
-
r.t = this.t + n;
|
774
|
-
r.s = this.s;
|
775
|
-
};
|
776
|
-
// BigInteger.prototype.drShiftTo = bnpDRShiftTo;
|
777
|
-
// (protected) r = this >> n*DB
|
778
|
-
BigInteger.prototype.drShiftTo = function (n, r) {
|
779
|
-
for (var i = n; i < this.t; ++i) {
|
780
|
-
r[i - n] = this[i];
|
781
|
-
}
|
782
|
-
r.t = Math.max(this.t - n, 0);
|
783
|
-
r.s = this.s;
|
784
|
-
};
|
785
|
-
// BigInteger.prototype.lShiftTo = bnpLShiftTo;
|
786
|
-
// (protected) r = this << n
|
787
|
-
BigInteger.prototype.lShiftTo = function (n, r) {
|
788
|
-
var bs = n % this.DB;
|
789
|
-
var cbs = this.DB - bs;
|
790
|
-
var bm = (1 << cbs) - 1;
|
791
|
-
var ds = Math.floor(n / this.DB);
|
792
|
-
var c = (this.s << bs) & this.DM;
|
793
|
-
for (var i = this.t - 1; i >= 0; --i) {
|
794
|
-
r[i + ds + 1] = (this[i] >> cbs) | c;
|
795
|
-
c = (this[i] & bm) << bs;
|
796
|
-
}
|
797
|
-
for (var i = ds - 1; i >= 0; --i) {
|
798
|
-
r[i] = 0;
|
799
|
-
}
|
800
|
-
r[ds] = c;
|
801
|
-
r.t = this.t + ds + 1;
|
802
|
-
r.s = this.s;
|
803
|
-
r.clamp();
|
804
|
-
};
|
805
|
-
// BigInteger.prototype.rShiftTo = bnpRShiftTo;
|
806
|
-
// (protected) r = this >> n
|
807
|
-
BigInteger.prototype.rShiftTo = function (n, r) {
|
808
|
-
r.s = this.s;
|
809
|
-
var ds = Math.floor(n / this.DB);
|
810
|
-
if (ds >= this.t) {
|
811
|
-
r.t = 0;
|
812
|
-
return;
|
813
|
-
}
|
814
|
-
var bs = n % this.DB;
|
815
|
-
var cbs = this.DB - bs;
|
816
|
-
var bm = (1 << bs) - 1;
|
817
|
-
r[0] = this[ds] >> bs;
|
818
|
-
for (var i = ds + 1; i < this.t; ++i) {
|
819
|
-
r[i - ds - 1] |= (this[i] & bm) << cbs;
|
820
|
-
r[i - ds] = this[i] >> bs;
|
821
|
-
}
|
822
|
-
if (bs > 0) {
|
823
|
-
r[this.t - ds - 1] |= (this.s & bm) << cbs;
|
824
|
-
}
|
825
|
-
r.t = this.t - ds;
|
826
|
-
r.clamp();
|
827
|
-
};
|
828
|
-
// BigInteger.prototype.subTo = bnpSubTo;
|
829
|
-
// (protected) r = this - a
|
830
|
-
BigInteger.prototype.subTo = function (a, r) {
|
831
|
-
var i = 0;
|
832
|
-
var c = 0;
|
833
|
-
var m = Math.min(a.t, this.t);
|
834
|
-
while (i < m) {
|
835
|
-
c += this[i] - a[i];
|
836
|
-
r[i++] = c & this.DM;
|
837
|
-
c >>= this.DB;
|
838
|
-
}
|
839
|
-
if (a.t < this.t) {
|
840
|
-
c -= a.s;
|
841
|
-
while (i < this.t) {
|
842
|
-
c += this[i];
|
843
|
-
r[i++] = c & this.DM;
|
844
|
-
c >>= this.DB;
|
845
|
-
}
|
846
|
-
c += this.s;
|
847
|
-
}
|
848
|
-
else {
|
849
|
-
c += this.s;
|
850
|
-
while (i < a.t) {
|
851
|
-
c -= a[i];
|
852
|
-
r[i++] = c & this.DM;
|
853
|
-
c >>= this.DB;
|
854
|
-
}
|
855
|
-
c -= a.s;
|
856
|
-
}
|
857
|
-
r.s = (c < 0) ? -1 : 0;
|
858
|
-
if (c < -1) {
|
859
|
-
r[i++] = this.DV + c;
|
860
|
-
}
|
861
|
-
else if (c > 0) {
|
862
|
-
r[i++] = c;
|
863
|
-
}
|
864
|
-
r.t = i;
|
865
|
-
r.clamp();
|
866
|
-
};
|
867
|
-
// BigInteger.prototype.multiplyTo = bnpMultiplyTo;
|
868
|
-
// (protected) r = this * a, r != this,a (HAC 14.12)
|
869
|
-
// "this" should be the larger one if appropriate.
|
870
|
-
BigInteger.prototype.multiplyTo = function (a, r) {
|
871
|
-
var x = this.abs();
|
872
|
-
var y = a.abs();
|
873
|
-
var i = x.t;
|
874
|
-
r.t = i + y.t;
|
875
|
-
while (--i >= 0) {
|
876
|
-
r[i] = 0;
|
877
|
-
}
|
878
|
-
for (i = 0; i < y.t; ++i) {
|
879
|
-
r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);
|
880
|
-
}
|
881
|
-
r.s = 0;
|
882
|
-
r.clamp();
|
883
|
-
if (this.s != a.s) {
|
884
|
-
BigInteger.ZERO.subTo(r, r);
|
885
|
-
}
|
886
|
-
};
|
887
|
-
// BigInteger.prototype.squareTo = bnpSquareTo;
|
888
|
-
// (protected) r = this^2, r != this (HAC 14.16)
|
889
|
-
BigInteger.prototype.squareTo = function (r) {
|
890
|
-
var x = this.abs();
|
891
|
-
var i = r.t = 2 * x.t;
|
892
|
-
while (--i >= 0) {
|
893
|
-
r[i] = 0;
|
894
|
-
}
|
895
|
-
for (i = 0; i < x.t - 1; ++i) {
|
896
|
-
var c = x.am(i, x[i], r, 2 * i, 0, 1);
|
897
|
-
if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {
|
898
|
-
r[i + x.t] -= x.DV;
|
899
|
-
r[i + x.t + 1] = 1;
|
900
|
-
}
|
901
|
-
}
|
902
|
-
if (r.t > 0) {
|
903
|
-
r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);
|
904
|
-
}
|
905
|
-
r.s = 0;
|
906
|
-
r.clamp();
|
907
|
-
};
|
908
|
-
// BigInteger.prototype.divRemTo = bnpDivRemTo;
|
909
|
-
// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
|
910
|
-
// r != q, this != m. q or r may be null.
|
911
|
-
BigInteger.prototype.divRemTo = function (m, q, r) {
|
912
|
-
var pm = m.abs();
|
913
|
-
if (pm.t <= 0) {
|
914
|
-
return;
|
915
|
-
}
|
916
|
-
var pt = this.abs();
|
917
|
-
if (pt.t < pm.t) {
|
918
|
-
if (q != null) {
|
919
|
-
q.fromInt(0);
|
920
|
-
}
|
921
|
-
if (r != null) {
|
922
|
-
this.copyTo(r);
|
923
|
-
}
|
924
|
-
return;
|
925
|
-
}
|
926
|
-
if (r == null) {
|
927
|
-
r = nbi();
|
928
|
-
}
|
929
|
-
var y = nbi();
|
930
|
-
var ts = this.s;
|
931
|
-
var ms = m.s;
|
932
|
-
var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus
|
933
|
-
if (nsh > 0) {
|
934
|
-
pm.lShiftTo(nsh, y);
|
935
|
-
pt.lShiftTo(nsh, r);
|
936
|
-
}
|
937
|
-
else {
|
938
|
-
pm.copyTo(y);
|
939
|
-
pt.copyTo(r);
|
940
|
-
}
|
941
|
-
var ys = y.t;
|
942
|
-
var y0 = y[ys - 1];
|
943
|
-
if (y0 == 0) {
|
944
|
-
return;
|
945
|
-
}
|
946
|
-
var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0);
|
947
|
-
var d1 = this.FV / yt;
|
948
|
-
var d2 = (1 << this.F1) / yt;
|
949
|
-
var e = 1 << this.F2;
|
950
|
-
var i = r.t;
|
951
|
-
var j = i - ys;
|
952
|
-
var t = (q == null) ? nbi() : q;
|
953
|
-
y.dlShiftTo(j, t);
|
954
|
-
if (r.compareTo(t) >= 0) {
|
955
|
-
r[r.t++] = 1;
|
956
|
-
r.subTo(t, r);
|
957
|
-
}
|
958
|
-
BigInteger.ONE.dlShiftTo(ys, t);
|
959
|
-
t.subTo(y, y); // "negative" y so we can replace sub with am later
|
960
|
-
while (y.t < ys) {
|
961
|
-
y[y.t++] = 0;
|
962
|
-
}
|
963
|
-
while (--j >= 0) {
|
964
|
-
// Estimate quotient digit
|
965
|
-
var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);
|
966
|
-
if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out
|
967
|
-
y.dlShiftTo(j, t);
|
968
|
-
r.subTo(t, r);
|
969
|
-
while (r[i] < --qd) {
|
970
|
-
r.subTo(t, r);
|
971
|
-
}
|
972
|
-
}
|
973
|
-
}
|
974
|
-
if (q != null) {
|
975
|
-
r.drShiftTo(ys, q);
|
976
|
-
if (ts != ms) {
|
977
|
-
BigInteger.ZERO.subTo(q, q);
|
978
|
-
}
|
979
|
-
}
|
980
|
-
r.t = ys;
|
981
|
-
r.clamp();
|
982
|
-
if (nsh > 0) {
|
983
|
-
r.rShiftTo(nsh, r);
|
984
|
-
} // Denormalize remainder
|
985
|
-
if (ts < 0) {
|
986
|
-
BigInteger.ZERO.subTo(r, r);
|
987
|
-
}
|
988
|
-
};
|
989
|
-
// BigInteger.prototype.invDigit = bnpInvDigit;
|
990
|
-
// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
|
991
|
-
// justification:
|
992
|
-
// xy == 1 (mod m)
|
993
|
-
// xy = 1+km
|
994
|
-
// xy(2-xy) = (1+km)(1-km)
|
995
|
-
// x[y(2-xy)] = 1-k^2m^2
|
996
|
-
// x[y(2-xy)] == 1 (mod m^2)
|
997
|
-
// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
|
998
|
-
// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
|
999
|
-
// JS multiply "overflows" differently from C/C++, so care is needed here.
|
1000
|
-
BigInteger.prototype.invDigit = function () {
|
1001
|
-
if (this.t < 1) {
|
1002
|
-
return 0;
|
1003
|
-
}
|
1004
|
-
var x = this[0];
|
1005
|
-
if ((x & 1) == 0) {
|
1006
|
-
return 0;
|
1007
|
-
}
|
1008
|
-
var y = x & 3; // y == 1/x mod 2^2
|
1009
|
-
y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4
|
1010
|
-
y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8
|
1011
|
-
y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16
|
1012
|
-
// last step - calculate inverse mod DV directly;
|
1013
|
-
// assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
|
1014
|
-
y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits
|
1015
|
-
// we really want the negative inverse, and -DV < y < DV
|
1016
|
-
return (y > 0) ? this.DV - y : -y;
|
1017
|
-
};
|
1018
|
-
// BigInteger.prototype.isEven = bnpIsEven;
|
1019
|
-
// (protected) true iff this is even
|
1020
|
-
BigInteger.prototype.isEven = function () {
|
1021
|
-
return ((this.t > 0) ? (this[0] & 1) : this.s) == 0;
|
1022
|
-
};
|
1023
|
-
// BigInteger.prototype.exp = bnpExp;
|
1024
|
-
// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
|
1025
|
-
BigInteger.prototype.exp = function (e, z) {
|
1026
|
-
if (e > 0xffffffff || e < 1) {
|
1027
|
-
return BigInteger.ONE;
|
1028
|
-
}
|
1029
|
-
var r = nbi();
|
1030
|
-
var r2 = nbi();
|
1031
|
-
var g = z.convert(this);
|
1032
|
-
var i = nbits(e) - 1;
|
1033
|
-
g.copyTo(r);
|
1034
|
-
while (--i >= 0) {
|
1035
|
-
z.sqrTo(r, r2);
|
1036
|
-
if ((e & (1 << i)) > 0) {
|
1037
|
-
z.mulTo(r2, g, r);
|
1038
|
-
}
|
1039
|
-
else {
|
1040
|
-
var t = r;
|
1041
|
-
r = r2;
|
1042
|
-
r2 = t;
|
1043
|
-
}
|
1044
|
-
}
|
1045
|
-
return z.revert(r);
|
1046
|
-
};
|
1047
|
-
// BigInteger.prototype.chunkSize = bnpChunkSize;
|
1048
|
-
// (protected) return x s.t. r^x < DV
|
1049
|
-
BigInteger.prototype.chunkSize = function (r) {
|
1050
|
-
return Math.floor(Math.LN2 * this.DB / Math.log(r));
|
1051
|
-
};
|
1052
|
-
// BigInteger.prototype.toRadix = bnpToRadix;
|
1053
|
-
// (protected) convert to radix string
|
1054
|
-
BigInteger.prototype.toRadix = function (b) {
|
1055
|
-
if (b == null) {
|
1056
|
-
b = 10;
|
1057
|
-
}
|
1058
|
-
if (this.signum() == 0 || b < 2 || b > 36) {
|
1059
|
-
return "0";
|
1060
|
-
}
|
1061
|
-
var cs = this.chunkSize(b);
|
1062
|
-
var a = Math.pow(b, cs);
|
1063
|
-
var d = nbv(a);
|
1064
|
-
var y = nbi();
|
1065
|
-
var z = nbi();
|
1066
|
-
var r = "";
|
1067
|
-
this.divRemTo(d, y, z);
|
1068
|
-
while (y.signum() > 0) {
|
1069
|
-
r = (a + z.intValue()).toString(b).substr(1) + r;
|
1070
|
-
y.divRemTo(d, y, z);
|
1071
|
-
}
|
1072
|
-
return z.intValue().toString(b) + r;
|
1073
|
-
};
|
1074
|
-
// BigInteger.prototype.fromRadix = bnpFromRadix;
|
1075
|
-
// (protected) convert from radix string
|
1076
|
-
BigInteger.prototype.fromRadix = function (s, b) {
|
1077
|
-
this.fromInt(0);
|
1078
|
-
if (b == null) {
|
1079
|
-
b = 10;
|
1080
|
-
}
|
1081
|
-
var cs = this.chunkSize(b);
|
1082
|
-
var d = Math.pow(b, cs);
|
1083
|
-
var mi = false;
|
1084
|
-
var j = 0;
|
1085
|
-
var w = 0;
|
1086
|
-
for (var i = 0; i < s.length; ++i) {
|
1087
|
-
var x = intAt(s, i);
|
1088
|
-
if (x < 0) {
|
1089
|
-
if (s.charAt(i) == "-" && this.signum() == 0) {
|
1090
|
-
mi = true;
|
1091
|
-
}
|
1092
|
-
continue;
|
1093
|
-
}
|
1094
|
-
w = b * w + x;
|
1095
|
-
if (++j >= cs) {
|
1096
|
-
this.dMultiply(d);
|
1097
|
-
this.dAddOffset(w, 0);
|
1098
|
-
j = 0;
|
1099
|
-
w = 0;
|
1100
|
-
}
|
1101
|
-
}
|
1102
|
-
if (j > 0) {
|
1103
|
-
this.dMultiply(Math.pow(b, j));
|
1104
|
-
this.dAddOffset(w, 0);
|
1105
|
-
}
|
1106
|
-
if (mi) {
|
1107
|
-
BigInteger.ZERO.subTo(this, this);
|
1108
|
-
}
|
1109
|
-
};
|
1110
|
-
// BigInteger.prototype.fromNumber = bnpFromNumber;
|
1111
|
-
// (protected) alternate constructor
|
1112
|
-
BigInteger.prototype.fromNumber = function (a, b, c) {
|
1113
|
-
if ("number" == typeof b) {
|
1114
|
-
// new BigInteger(int,int,RNG)
|
1115
|
-
if (a < 2) {
|
1116
|
-
this.fromInt(1);
|
1117
|
-
}
|
1118
|
-
else {
|
1119
|
-
this.fromNumber(a, c);
|
1120
|
-
if (!this.testBit(a - 1)) {
|
1121
|
-
// force MSB set
|
1122
|
-
this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);
|
1123
|
-
}
|
1124
|
-
if (this.isEven()) {
|
1125
|
-
this.dAddOffset(1, 0);
|
1126
|
-
} // force odd
|
1127
|
-
while (!this.isProbablePrime(b)) {
|
1128
|
-
this.dAddOffset(2, 0);
|
1129
|
-
if (this.bitLength() > a) {
|
1130
|
-
this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);
|
1131
|
-
}
|
1132
|
-
}
|
1133
|
-
}
|
1134
|
-
}
|
1135
|
-
else {
|
1136
|
-
// new BigInteger(int,RNG)
|
1137
|
-
var x = [];
|
1138
|
-
var t = a & 7;
|
1139
|
-
x.length = (a >> 3) + 1;
|
1140
|
-
b.nextBytes(x);
|
1141
|
-
if (t > 0) {
|
1142
|
-
x[0] &= ((1 << t) - 1);
|
1143
|
-
}
|
1144
|
-
else {
|
1145
|
-
x[0] = 0;
|
1146
|
-
}
|
1147
|
-
this.fromString(x, 256);
|
1148
|
-
}
|
1149
|
-
};
|
1150
|
-
// BigInteger.prototype.bitwiseTo = bnpBitwiseTo;
|
1151
|
-
// (protected) r = this op a (bitwise)
|
1152
|
-
BigInteger.prototype.bitwiseTo = function (a, op, r) {
|
1153
|
-
var i;
|
1154
|
-
var f;
|
1155
|
-
var m = Math.min(a.t, this.t);
|
1156
|
-
for (i = 0; i < m; ++i) {
|
1157
|
-
r[i] = op(this[i], a[i]);
|
1158
|
-
}
|
1159
|
-
if (a.t < this.t) {
|
1160
|
-
f = a.s & this.DM;
|
1161
|
-
for (i = m; i < this.t; ++i) {
|
1162
|
-
r[i] = op(this[i], f);
|
1163
|
-
}
|
1164
|
-
r.t = this.t;
|
1165
|
-
}
|
1166
|
-
else {
|
1167
|
-
f = this.s & this.DM;
|
1168
|
-
for (i = m; i < a.t; ++i) {
|
1169
|
-
r[i] = op(f, a[i]);
|
1170
|
-
}
|
1171
|
-
r.t = a.t;
|
1172
|
-
}
|
1173
|
-
r.s = op(this.s, a.s);
|
1174
|
-
r.clamp();
|
1175
|
-
};
|
1176
|
-
// BigInteger.prototype.changeBit = bnpChangeBit;
|
1177
|
-
// (protected) this op (1<<n)
|
1178
|
-
BigInteger.prototype.changeBit = function (n, op) {
|
1179
|
-
var r = BigInteger.ONE.shiftLeft(n);
|
1180
|
-
this.bitwiseTo(r, op, r);
|
1181
|
-
return r;
|
1182
|
-
};
|
1183
|
-
// BigInteger.prototype.addTo = bnpAddTo;
|
1184
|
-
// (protected) r = this + a
|
1185
|
-
BigInteger.prototype.addTo = function (a, r) {
|
1186
|
-
var i = 0;
|
1187
|
-
var c = 0;
|
1188
|
-
var m = Math.min(a.t, this.t);
|
1189
|
-
while (i < m) {
|
1190
|
-
c += this[i] + a[i];
|
1191
|
-
r[i++] = c & this.DM;
|
1192
|
-
c >>= this.DB;
|
1193
|
-
}
|
1194
|
-
if (a.t < this.t) {
|
1195
|
-
c += a.s;
|
1196
|
-
while (i < this.t) {
|
1197
|
-
c += this[i];
|
1198
|
-
r[i++] = c & this.DM;
|
1199
|
-
c >>= this.DB;
|
1200
|
-
}
|
1201
|
-
c += this.s;
|
1202
|
-
}
|
1203
|
-
else {
|
1204
|
-
c += this.s;
|
1205
|
-
while (i < a.t) {
|
1206
|
-
c += a[i];
|
1207
|
-
r[i++] = c & this.DM;
|
1208
|
-
c >>= this.DB;
|
1209
|
-
}
|
1210
|
-
c += a.s;
|
1211
|
-
}
|
1212
|
-
r.s = (c < 0) ? -1 : 0;
|
1213
|
-
if (c > 0) {
|
1214
|
-
r[i++] = c;
|
1215
|
-
}
|
1216
|
-
else if (c < -1) {
|
1217
|
-
r[i++] = this.DV + c;
|
1218
|
-
}
|
1219
|
-
r.t = i;
|
1220
|
-
r.clamp();
|
1221
|
-
};
|
1222
|
-
// BigInteger.prototype.dMultiply = bnpDMultiply;
|
1223
|
-
// (protected) this *= n, this >= 0, 1 < n < DV
|
1224
|
-
BigInteger.prototype.dMultiply = function (n) {
|
1225
|
-
this[this.t] = this.am(0, n - 1, this, 0, 0, this.t);
|
1226
|
-
++this.t;
|
1227
|
-
this.clamp();
|
1228
|
-
};
|
1229
|
-
// BigInteger.prototype.dAddOffset = bnpDAddOffset;
|
1230
|
-
// (protected) this += n << w words, this >= 0
|
1231
|
-
BigInteger.prototype.dAddOffset = function (n, w) {
|
1232
|
-
if (n == 0) {
|
1233
|
-
return;
|
1234
|
-
}
|
1235
|
-
while (this.t <= w) {
|
1236
|
-
this[this.t++] = 0;
|
1237
|
-
}
|
1238
|
-
this[w] += n;
|
1239
|
-
while (this[w] >= this.DV) {
|
1240
|
-
this[w] -= this.DV;
|
1241
|
-
if (++w >= this.t) {
|
1242
|
-
this[this.t++] = 0;
|
1243
|
-
}
|
1244
|
-
++this[w];
|
1245
|
-
}
|
1246
|
-
};
|
1247
|
-
// BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;
|
1248
|
-
// (protected) r = lower n words of "this * a", a.t <= n
|
1249
|
-
// "this" should be the larger one if appropriate.
|
1250
|
-
BigInteger.prototype.multiplyLowerTo = function (a, n, r) {
|
1251
|
-
var i = Math.min(this.t + a.t, n);
|
1252
|
-
r.s = 0; // assumes a,this >= 0
|
1253
|
-
r.t = i;
|
1254
|
-
while (i > 0) {
|
1255
|
-
r[--i] = 0;
|
1256
|
-
}
|
1257
|
-
for (var j = r.t - this.t; i < j; ++i) {
|
1258
|
-
r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);
|
1259
|
-
}
|
1260
|
-
for (var j = Math.min(a.t, n); i < j; ++i) {
|
1261
|
-
this.am(0, a[i], r, i, 0, n - i);
|
1262
|
-
}
|
1263
|
-
r.clamp();
|
1264
|
-
};
|
1265
|
-
// BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;
|
1266
|
-
// (protected) r = "this * a" without lower n words, n > 0
|
1267
|
-
// "this" should be the larger one if appropriate.
|
1268
|
-
BigInteger.prototype.multiplyUpperTo = function (a, n, r) {
|
1269
|
-
--n;
|
1270
|
-
var i = r.t = this.t + a.t - n;
|
1271
|
-
r.s = 0; // assumes a,this >= 0
|
1272
|
-
while (--i >= 0) {
|
1273
|
-
r[i] = 0;
|
1274
|
-
}
|
1275
|
-
for (i = Math.max(n - this.t, 0); i < a.t; ++i) {
|
1276
|
-
r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);
|
1277
|
-
}
|
1278
|
-
r.clamp();
|
1279
|
-
r.drShiftTo(1, r);
|
1280
|
-
};
|
1281
|
-
// BigInteger.prototype.modInt = bnpModInt;
|
1282
|
-
// (protected) this % n, n < 2^26
|
1283
|
-
BigInteger.prototype.modInt = function (n) {
|
1284
|
-
if (n <= 0) {
|
1285
|
-
return 0;
|
1286
|
-
}
|
1287
|
-
var d = this.DV % n;
|
1288
|
-
var r = (this.s < 0) ? n - 1 : 0;
|
1289
|
-
if (this.t > 0) {
|
1290
|
-
if (d == 0) {
|
1291
|
-
r = this[0] % n;
|
1292
|
-
}
|
1293
|
-
else {
|
1294
|
-
for (var i = this.t - 1; i >= 0; --i) {
|
1295
|
-
r = (d * r + this[i]) % n;
|
1296
|
-
}
|
1297
|
-
}
|
1298
|
-
}
|
1299
|
-
return r;
|
1300
|
-
};
|
1301
|
-
// BigInteger.prototype.millerRabin = bnpMillerRabin;
|
1302
|
-
// (protected) true if probably prime (HAC 4.24, Miller-Rabin)
|
1303
|
-
BigInteger.prototype.millerRabin = function (t) {
|
1304
|
-
var n1 = this.subtract(BigInteger.ONE);
|
1305
|
-
var k = n1.getLowestSetBit();
|
1306
|
-
if (k <= 0) {
|
1307
|
-
return false;
|
1308
|
-
}
|
1309
|
-
var r = n1.shiftRight(k);
|
1310
|
-
t = (t + 1) >> 1;
|
1311
|
-
if (t > lowprimes.length) {
|
1312
|
-
t = lowprimes.length;
|
1313
|
-
}
|
1314
|
-
var a = nbi();
|
1315
|
-
for (var i = 0; i < t; ++i) {
|
1316
|
-
// Pick bases at random, instead of starting at 2
|
1317
|
-
a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);
|
1318
|
-
var y = a.modPow(r, this);
|
1319
|
-
if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {
|
1320
|
-
var j = 1;
|
1321
|
-
while (j++ < k && y.compareTo(n1) != 0) {
|
1322
|
-
y = y.modPowInt(2, this);
|
1323
|
-
if (y.compareTo(BigInteger.ONE) == 0) {
|
1324
|
-
return false;
|
1325
|
-
}
|
1326
|
-
}
|
1327
|
-
if (y.compareTo(n1) != 0) {
|
1328
|
-
return false;
|
1329
|
-
}
|
1330
|
-
}
|
1331
|
-
}
|
1332
|
-
return true;
|
1333
|
-
};
|
1334
|
-
// BigInteger.prototype.square = bnSquare;
|
1335
|
-
// (public) this^2
|
1336
|
-
BigInteger.prototype.square = function () {
|
1337
|
-
var r = nbi();
|
1338
|
-
this.squareTo(r);
|
1339
|
-
return r;
|
1340
|
-
};
|
1341
|
-
//#region ASYNC
|
1342
|
-
// Public API method
|
1343
|
-
BigInteger.prototype.gcda = function (a, callback) {
|
1344
|
-
var x = (this.s < 0) ? this.negate() : this.clone();
|
1345
|
-
var y = (a.s < 0) ? a.negate() : a.clone();
|
1346
|
-
if (x.compareTo(y) < 0) {
|
1347
|
-
var t = x;
|
1348
|
-
x = y;
|
1349
|
-
y = t;
|
1350
|
-
}
|
1351
|
-
var i = x.getLowestSetBit();
|
1352
|
-
var g = y.getLowestSetBit();
|
1353
|
-
if (g < 0) {
|
1354
|
-
callback(x);
|
1355
|
-
return;
|
1356
|
-
}
|
1357
|
-
if (i < g) {
|
1358
|
-
g = i;
|
1359
|
-
}
|
1360
|
-
if (g > 0) {
|
1361
|
-
x.rShiftTo(g, x);
|
1362
|
-
y.rShiftTo(g, y);
|
1363
|
-
}
|
1364
|
-
// Workhorse of the algorithm, gets called 200 - 800 times per 512 bit keygen.
|
1365
|
-
var gcda1 = function () {
|
1366
|
-
if ((i = x.getLowestSetBit()) > 0) {
|
1367
|
-
x.rShiftTo(i, x);
|
1368
|
-
}
|
1369
|
-
if ((i = y.getLowestSetBit()) > 0) {
|
1370
|
-
y.rShiftTo(i, y);
|
1371
|
-
}
|
1372
|
-
if (x.compareTo(y) >= 0) {
|
1373
|
-
x.subTo(y, x);
|
1374
|
-
x.rShiftTo(1, x);
|
1375
|
-
}
|
1376
|
-
else {
|
1377
|
-
y.subTo(x, y);
|
1378
|
-
y.rShiftTo(1, y);
|
1379
|
-
}
|
1380
|
-
if (!(x.signum() > 0)) {
|
1381
|
-
if (g > 0) {
|
1382
|
-
y.lShiftTo(g, y);
|
1383
|
-
}
|
1384
|
-
setTimeout(function () { callback(y); }, 0); // escape
|
1385
|
-
}
|
1386
|
-
else {
|
1387
|
-
setTimeout(gcda1, 0);
|
1388
|
-
}
|
1389
|
-
};
|
1390
|
-
setTimeout(gcda1, 10);
|
1391
|
-
};
|
1392
|
-
// (protected) alternate constructor
|
1393
|
-
BigInteger.prototype.fromNumberAsync = function (a, b, c, callback) {
|
1394
|
-
if ("number" == typeof b) {
|
1395
|
-
if (a < 2) {
|
1396
|
-
this.fromInt(1);
|
1397
|
-
}
|
1398
|
-
else {
|
1399
|
-
this.fromNumber(a, c);
|
1400
|
-
if (!this.testBit(a - 1)) {
|
1401
|
-
this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);
|
1402
|
-
}
|
1403
|
-
if (this.isEven()) {
|
1404
|
-
this.dAddOffset(1, 0);
|
1405
|
-
}
|
1406
|
-
var bnp_1 = this;
|
1407
|
-
var bnpfn1_1 = function () {
|
1408
|
-
bnp_1.dAddOffset(2, 0);
|
1409
|
-
if (bnp_1.bitLength() > a) {
|
1410
|
-
bnp_1.subTo(BigInteger.ONE.shiftLeft(a - 1), bnp_1);
|
1411
|
-
}
|
1412
|
-
if (bnp_1.isProbablePrime(b)) {
|
1413
|
-
setTimeout(function () { callback(); }, 0); // escape
|
1414
|
-
}
|
1415
|
-
else {
|
1416
|
-
setTimeout(bnpfn1_1, 0);
|
1417
|
-
}
|
1418
|
-
};
|
1419
|
-
setTimeout(bnpfn1_1, 0);
|
1420
|
-
}
|
1421
|
-
}
|
1422
|
-
else {
|
1423
|
-
var x = [];
|
1424
|
-
var t = a & 7;
|
1425
|
-
x.length = (a >> 3) + 1;
|
1426
|
-
b.nextBytes(x);
|
1427
|
-
if (t > 0) {
|
1428
|
-
x[0] &= ((1 << t) - 1);
|
1429
|
-
}
|
1430
|
-
else {
|
1431
|
-
x[0] = 0;
|
1432
|
-
}
|
1433
|
-
this.fromString(x, 256);
|
1434
|
-
}
|
1435
|
-
};
|
1436
|
-
return BigInteger;
|
1437
|
-
}());
|
1438
|
-
export { BigInteger };
|
1439
|
-
//#region REDUCERS
|
1440
|
-
//#region NullExp
|
1441
|
-
var NullExp = /** @class */ (function () {
|
1442
|
-
function NullExp() {
|
1443
|
-
}
|
1444
|
-
// NullExp.prototype.convert = nNop;
|
1445
|
-
NullExp.prototype.convert = function (x) {
|
1446
|
-
return x;
|
1447
|
-
};
|
1448
|
-
// NullExp.prototype.revert = nNop;
|
1449
|
-
NullExp.prototype.revert = function (x) {
|
1450
|
-
return x;
|
1451
|
-
};
|
1452
|
-
// NullExp.prototype.mulTo = nMulTo;
|
1453
|
-
NullExp.prototype.mulTo = function (x, y, r) {
|
1454
|
-
x.multiplyTo(y, r);
|
1455
|
-
};
|
1456
|
-
// NullExp.prototype.sqrTo = nSqrTo;
|
1457
|
-
NullExp.prototype.sqrTo = function (x, r) {
|
1458
|
-
x.squareTo(r);
|
1459
|
-
};
|
1460
|
-
return NullExp;
|
1461
|
-
}());
|
1462
|
-
// Modular reduction using "classic" algorithm
|
1463
|
-
var Classic = /** @class */ (function () {
|
1464
|
-
function Classic(m) {
|
1465
|
-
this.m = m;
|
1466
|
-
}
|
1467
|
-
// Classic.prototype.convert = cConvert;
|
1468
|
-
Classic.prototype.convert = function (x) {
|
1469
|
-
if (x.s < 0 || x.compareTo(this.m) >= 0) {
|
1470
|
-
return x.mod(this.m);
|
1471
|
-
}
|
1472
|
-
else {
|
1473
|
-
return x;
|
1474
|
-
}
|
1475
|
-
};
|
1476
|
-
// Classic.prototype.revert = cRevert;
|
1477
|
-
Classic.prototype.revert = function (x) {
|
1478
|
-
return x;
|
1479
|
-
};
|
1480
|
-
// Classic.prototype.reduce = cReduce;
|
1481
|
-
Classic.prototype.reduce = function (x) {
|
1482
|
-
x.divRemTo(this.m, null, x);
|
1483
|
-
};
|
1484
|
-
// Classic.prototype.mulTo = cMulTo;
|
1485
|
-
Classic.prototype.mulTo = function (x, y, r) {
|
1486
|
-
x.multiplyTo(y, r);
|
1487
|
-
this.reduce(r);
|
1488
|
-
};
|
1489
|
-
// Classic.prototype.sqrTo = cSqrTo;
|
1490
|
-
Classic.prototype.sqrTo = function (x, r) {
|
1491
|
-
x.squareTo(r);
|
1492
|
-
this.reduce(r);
|
1493
|
-
};
|
1494
|
-
return Classic;
|
1495
|
-
}());
|
1496
|
-
//#endregion
|
1497
|
-
//#region Montgomery
|
1498
|
-
// Montgomery reduction
|
1499
|
-
var Montgomery = /** @class */ (function () {
|
1500
|
-
function Montgomery(m) {
|
1501
|
-
this.m = m;
|
1502
|
-
this.mp = m.invDigit();
|
1503
|
-
this.mpl = this.mp & 0x7fff;
|
1504
|
-
this.mph = this.mp >> 15;
|
1505
|
-
this.um = (1 << (m.DB - 15)) - 1;
|
1506
|
-
this.mt2 = 2 * m.t;
|
1507
|
-
}
|
1508
|
-
// Montgomery.prototype.convert = montConvert;
|
1509
|
-
// xR mod m
|
1510
|
-
Montgomery.prototype.convert = function (x) {
|
1511
|
-
var r = nbi();
|
1512
|
-
x.abs().dlShiftTo(this.m.t, r);
|
1513
|
-
r.divRemTo(this.m, null, r);
|
1514
|
-
if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) {
|
1515
|
-
this.m.subTo(r, r);
|
1516
|
-
}
|
1517
|
-
return r;
|
1518
|
-
};
|
1519
|
-
// Montgomery.prototype.revert = montRevert;
|
1520
|
-
// x/R mod m
|
1521
|
-
Montgomery.prototype.revert = function (x) {
|
1522
|
-
var r = nbi();
|
1523
|
-
x.copyTo(r);
|
1524
|
-
this.reduce(r);
|
1525
|
-
return r;
|
1526
|
-
};
|
1527
|
-
// Montgomery.prototype.reduce = montReduce;
|
1528
|
-
// x = x/R mod m (HAC 14.32)
|
1529
|
-
Montgomery.prototype.reduce = function (x) {
|
1530
|
-
while (x.t <= this.mt2) {
|
1531
|
-
// pad x so am has enough room later
|
1532
|
-
x[x.t++] = 0;
|
1533
|
-
}
|
1534
|
-
for (var i = 0; i < this.m.t; ++i) {
|
1535
|
-
// faster way of calculating u0 = x[i]*mp mod DV
|
1536
|
-
var j = x[i] & 0x7fff;
|
1537
|
-
var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM;
|
1538
|
-
// use am to combine the multiply-shift-add into one call
|
1539
|
-
j = i + this.m.t;
|
1540
|
-
x[j] += this.m.am(0, u0, x, i, 0, this.m.t);
|
1541
|
-
// propagate carry
|
1542
|
-
while (x[j] >= x.DV) {
|
1543
|
-
x[j] -= x.DV;
|
1544
|
-
x[++j]++;
|
1545
|
-
}
|
1546
|
-
}
|
1547
|
-
x.clamp();
|
1548
|
-
x.drShiftTo(this.m.t, x);
|
1549
|
-
if (x.compareTo(this.m) >= 0) {
|
1550
|
-
x.subTo(this.m, x);
|
1551
|
-
}
|
1552
|
-
};
|
1553
|
-
// Montgomery.prototype.mulTo = montMulTo;
|
1554
|
-
// r = "xy/R mod m"; x,y != r
|
1555
|
-
Montgomery.prototype.mulTo = function (x, y, r) {
|
1556
|
-
x.multiplyTo(y, r);
|
1557
|
-
this.reduce(r);
|
1558
|
-
};
|
1559
|
-
// Montgomery.prototype.sqrTo = montSqrTo;
|
1560
|
-
// r = "x^2/R mod m"; x != r
|
1561
|
-
Montgomery.prototype.sqrTo = function (x, r) {
|
1562
|
-
x.squareTo(r);
|
1563
|
-
this.reduce(r);
|
1564
|
-
};
|
1565
|
-
return Montgomery;
|
1566
|
-
}());
|
1567
|
-
//#endregion Montgomery
|
1568
|
-
//#region Barrett
|
1569
|
-
// Barrett modular reduction
|
1570
|
-
var Barrett = /** @class */ (function () {
|
1571
|
-
function Barrett(m) {
|
1572
|
-
this.m = m;
|
1573
|
-
// setup Barrett
|
1574
|
-
this.r2 = nbi();
|
1575
|
-
this.q3 = nbi();
|
1576
|
-
BigInteger.ONE.dlShiftTo(2 * m.t, this.r2);
|
1577
|
-
this.mu = this.r2.divide(m);
|
1578
|
-
}
|
1579
|
-
// Barrett.prototype.convert = barrettConvert;
|
1580
|
-
Barrett.prototype.convert = function (x) {
|
1581
|
-
if (x.s < 0 || x.t > 2 * this.m.t) {
|
1582
|
-
return x.mod(this.m);
|
1583
|
-
}
|
1584
|
-
else if (x.compareTo(this.m) < 0) {
|
1585
|
-
return x;
|
1586
|
-
}
|
1587
|
-
else {
|
1588
|
-
var r = nbi();
|
1589
|
-
x.copyTo(r);
|
1590
|
-
this.reduce(r);
|
1591
|
-
return r;
|
1592
|
-
}
|
1593
|
-
};
|
1594
|
-
// Barrett.prototype.revert = barrettRevert;
|
1595
|
-
Barrett.prototype.revert = function (x) {
|
1596
|
-
return x;
|
1597
|
-
};
|
1598
|
-
// Barrett.prototype.reduce = barrettReduce;
|
1599
|
-
// x = x mod m (HAC 14.42)
|
1600
|
-
Barrett.prototype.reduce = function (x) {
|
1601
|
-
x.drShiftTo(this.m.t - 1, this.r2);
|
1602
|
-
if (x.t > this.m.t + 1) {
|
1603
|
-
x.t = this.m.t + 1;
|
1604
|
-
x.clamp();
|
1605
|
-
}
|
1606
|
-
this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);
|
1607
|
-
this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);
|
1608
|
-
while (x.compareTo(this.r2) < 0) {
|
1609
|
-
x.dAddOffset(1, this.m.t + 1);
|
1610
|
-
}
|
1611
|
-
x.subTo(this.r2, x);
|
1612
|
-
while (x.compareTo(this.m) >= 0) {
|
1613
|
-
x.subTo(this.m, x);
|
1614
|
-
}
|
1615
|
-
};
|
1616
|
-
// Barrett.prototype.mulTo = barrettMulTo;
|
1617
|
-
// r = x*y mod m; x,y != r
|
1618
|
-
Barrett.prototype.mulTo = function (x, y, r) {
|
1619
|
-
x.multiplyTo(y, r);
|
1620
|
-
this.reduce(r);
|
1621
|
-
};
|
1622
|
-
// Barrett.prototype.sqrTo = barrettSqrTo;
|
1623
|
-
// r = x^2 mod m; x != r
|
1624
|
-
Barrett.prototype.sqrTo = function (x, r) {
|
1625
|
-
x.squareTo(r);
|
1626
|
-
this.reduce(r);
|
1627
|
-
};
|
1628
|
-
return Barrett;
|
1629
|
-
}());
|
1630
|
-
//#endregion
|
1631
|
-
//#endregion REDUCERS
|
1632
|
-
// return new, unset BigInteger
|
1633
|
-
export function nbi() { return new BigInteger(null); }
|
1634
|
-
export function parseBigInt(str, r) {
|
1635
|
-
return new BigInteger(str, r);
|
1636
|
-
}
|
1637
|
-
// am: Compute w_j += (x*this_i), propagate carries,
|
1638
|
-
// c is initial carry, returns final carry.
|
1639
|
-
// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
|
1640
|
-
// We need to select the fastest one that works in this environment.
|
1641
|
-
var inBrowser = typeof navigator !== "undefined";
|
1642
|
-
if (inBrowser && j_lm && (navigator.appName == "Microsoft Internet Explorer")) {
|
1643
|
-
// am2 avoids a big mult-and-extract completely.
|
1644
|
-
// Max digit bits should be <= 30 because we do bitwise ops
|
1645
|
-
// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
|
1646
|
-
BigInteger.prototype.am = function am2(i, x, w, j, c, n) {
|
1647
|
-
var xl = x & 0x7fff;
|
1648
|
-
var xh = x >> 15;
|
1649
|
-
while (--n >= 0) {
|
1650
|
-
var l = this[i] & 0x7fff;
|
1651
|
-
var h = this[i++] >> 15;
|
1652
|
-
var m = xh * l + h * xl;
|
1653
|
-
l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);
|
1654
|
-
c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);
|
1655
|
-
w[j++] = l & 0x3fffffff;
|
1656
|
-
}
|
1657
|
-
return c;
|
1658
|
-
};
|
1659
|
-
dbits = 30;
|
1660
|
-
}
|
1661
|
-
else if (inBrowser && j_lm && (navigator.appName != "Netscape")) {
|
1662
|
-
// am1: use a single mult and divide to get the high bits,
|
1663
|
-
// max digit bits should be 26 because
|
1664
|
-
// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
|
1665
|
-
BigInteger.prototype.am = function am1(i, x, w, j, c, n) {
|
1666
|
-
while (--n >= 0) {
|
1667
|
-
var v = x * this[i++] + w[j] + c;
|
1668
|
-
c = Math.floor(v / 0x4000000);
|
1669
|
-
w[j++] = v & 0x3ffffff;
|
1670
|
-
}
|
1671
|
-
return c;
|
1672
|
-
};
|
1673
|
-
dbits = 26;
|
1674
|
-
}
|
1675
|
-
else { // Mozilla/Netscape seems to prefer am3
|
1676
|
-
// Alternately, set max digit bits to 28 since some
|
1677
|
-
// browsers slow down when dealing with 32-bit numbers.
|
1678
|
-
BigInteger.prototype.am = function am3(i, x, w, j, c, n) {
|
1679
|
-
var xl = x & 0x3fff;
|
1680
|
-
var xh = x >> 14;
|
1681
|
-
while (--n >= 0) {
|
1682
|
-
var l = this[i] & 0x3fff;
|
1683
|
-
var h = this[i++] >> 14;
|
1684
|
-
var m = xh * l + h * xl;
|
1685
|
-
l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;
|
1686
|
-
c = (l >> 28) + (m >> 14) + xh * h;
|
1687
|
-
w[j++] = l & 0xfffffff;
|
1688
|
-
}
|
1689
|
-
return c;
|
1690
|
-
};
|
1691
|
-
dbits = 28;
|
1692
|
-
}
|
1693
|
-
BigInteger.prototype.DB = dbits;
|
1694
|
-
BigInteger.prototype.DM = ((1 << dbits) - 1);
|
1695
|
-
BigInteger.prototype.DV = (1 << dbits);
|
1696
|
-
var BI_FP = 52;
|
1697
|
-
BigInteger.prototype.FV = Math.pow(2, BI_FP);
|
1698
|
-
BigInteger.prototype.F1 = BI_FP - dbits;
|
1699
|
-
BigInteger.prototype.F2 = 2 * dbits - BI_FP;
|
1700
|
-
// Digit conversions
|
1701
|
-
var BI_RC = [];
|
1702
|
-
var rr;
|
1703
|
-
var vv;
|
1704
|
-
rr = "0".charCodeAt(0);
|
1705
|
-
for (vv = 0; vv <= 9; ++vv) {
|
1706
|
-
BI_RC[rr++] = vv;
|
1707
|
-
}
|
1708
|
-
rr = "a".charCodeAt(0);
|
1709
|
-
for (vv = 10; vv < 36; ++vv) {
|
1710
|
-
BI_RC[rr++] = vv;
|
1711
|
-
}
|
1712
|
-
rr = "A".charCodeAt(0);
|
1713
|
-
for (vv = 10; vv < 36; ++vv) {
|
1714
|
-
BI_RC[rr++] = vv;
|
1715
|
-
}
|
1716
|
-
export function intAt(s, i) {
|
1717
|
-
var c = BI_RC[s.charCodeAt(i)];
|
1718
|
-
return (c == null) ? -1 : c;
|
1719
|
-
}
|
1720
|
-
// return bigint initialized to value
|
1721
|
-
export function nbv(i) {
|
1722
|
-
var r = nbi();
|
1723
|
-
r.fromInt(i);
|
1724
|
-
return r;
|
1725
|
-
}
|
1726
|
-
// returns bit length of the integer x
|
1727
|
-
export function nbits(x) {
|
1728
|
-
var r = 1;
|
1729
|
-
var t;
|
1730
|
-
if ((t = x >>> 16) != 0) {
|
1731
|
-
x = t;
|
1732
|
-
r += 16;
|
1733
|
-
}
|
1734
|
-
if ((t = x >> 8) != 0) {
|
1735
|
-
x = t;
|
1736
|
-
r += 8;
|
1737
|
-
}
|
1738
|
-
if ((t = x >> 4) != 0) {
|
1739
|
-
x = t;
|
1740
|
-
r += 4;
|
1741
|
-
}
|
1742
|
-
if ((t = x >> 2) != 0) {
|
1743
|
-
x = t;
|
1744
|
-
r += 2;
|
1745
|
-
}
|
1746
|
-
if ((t = x >> 1) != 0) {
|
1747
|
-
x = t;
|
1748
|
-
r += 1;
|
1749
|
-
}
|
1750
|
-
return r;
|
1751
|
-
}
|
1752
|
-
// "constants"
|
1753
|
-
BigInteger.ZERO = nbv(0);
|
1754
|
-
BigInteger.ONE = nbv(1);
|